testformprimitive.java

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

JAVA
59
字号
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.FormPrimitives;import junit.framework.TestCase;import com.wiley.compBooks.EJwithUML.Base.TestUtilities.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements.*;import java.io.*;public class TestFormPrimitive extends TestCase{  private TestFileSet testFileSet;  public TestFormPrimitive(String name) throws IOException  {    super(name);    testFileSet = new TestFileSet("C:/EJwithUML2e/UnitTestResults/HtmlPrimitives/FormPrimitives/FormPrimitive/");  }  public void testEmptyForm() throws IOException  {    StringBuffer buffer = new StringBuffer();    FormPrimitive form = new FormPrimitive("http://sillyhost/", "form1");    form.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("EmptyForm.html", buffer.toString());    assertEquals("EmptyForm", match, true);  }  public void testForm() throws IOException  {    StringBuffer buffer = new StringBuffer();    TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand");    SelectionPrimitive selection = new SelectionPrimitive("favoriteFlavor");    selection.addValue("Vanilla Creme", "vanilla_creme", false);    selection.addValue("Fudge Ripple", "fudge_ripple", true);    selection.addValue("Strawberry", "strawberry", false);    TextPrimitive text = new TextPrimitive();    text.addLineBreak();    FormPrimitive form = new FormPrimitive("http://sillyhost/", "form1");    form.addPrimitive(text_box);    form.addPrimitive(text);    form.addPrimitive(selection);    form.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("Form.html", buffer.toString());    assertEquals("Form", match, true);  }  public static void main(String[] args)  {    junit.textui.TestRunner.run(TestFormPrimitive.class);  }}

⌨️ 快捷键说明

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