testlinkprimitive.java

来自「考勤管理系统源码」· Java 代码 · 共 70 行

JAVA
70
字号
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements;import junit.framework.*;import com.wiley.compBooks.EJwithUML.Base.TestUtilities.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.io.*;public class TestLinkPrimitive extends TestCase{  private TestFileSet testFileSet;  public TestLinkPrimitive(String name) throws IOException  {    super(name);    testFileSet = new TestFileSet("C:/EJwithUML2e/UnitTestResults/HtmlPrimitives/ContentElements/LinkPrimitive/");  }  public void testEmptyLink() throws IOException  {    LinkPrimitive link = new LinkPrimitive("http://www.javasoft.com");    StringBuffer buffer = new StringBuffer();    link.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("EmptyLink.html", buffer.toString());    assertEquals("EmptyLink", match, true);  }  public void testSimpleTextLink() throws IOException  {    TextPrimitive text = new TextPrimitive("Java Mecca");    LinkPrimitive link = new LinkPrimitive("http://www.javasoft.com");    link.addText(text);    StringBuffer buffer = new StringBuffer();    link.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("SimpleTextLink.html", buffer.toString());    assertEquals("SimpleTextLink", match, true);  }  public void testImageLink() throws IOException  {    ImagePrimitive image = new ImagePrimitive("./pic.jpg");    image.setSize(50,50);    image.setAlternateText("A completely unrelated image");    LinkPrimitive link = new LinkPrimitive("http://www.javasoft.com");    link.addImage(image);    StringBuffer buffer = new StringBuffer();    link.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("ImageLink.html", buffer.toString());    assertEquals("ImageLink", match, true);  }  public void testStyledTextLink() throws IOException  {    TextPrimitive text = new TextPrimitive("Java Mecca");    LinkPrimitive link = new LinkPrimitive("http://www.javasoft.com");    link.addText(text);    link.setStyle(Style.IMPORTANT_TEXT);    StringBuffer buffer = new StringBuffer();    link.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("StyledTextLink.html", buffer.toString());    assertEquals("StyledTextLink", match, true);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?