testsimpleinputformproducer.java

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

JAVA
57
字号
package com.wiley.compBooks.EJwithUML.TimecardProducers;import java.io.*;import junit.framework.TestCase;import com.wiley.compBooks.EJwithUML.Base.TestUtilities.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Layout.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;public class TestSimpleInputFormProducer extends TestCase{  private TestFileSet testFileSet;  public TestSimpleInputFormProducer(String name) throws IOException  {    super(name);    testFileSet = new TestFileSet("C:/EJwithUML2e/UnitTestResults/TimecardProducers/");  }  public void testEmptyForm() throws IOException  {    StringBuffer buffer = new StringBuffer();    SimpleInputFormProducer form = new SimpleInputFormProducer("Login", "Please enter your username and password.", "Press the Button", "./noservlet");    PagePrimitive page = new PagePrimitive("test", "../Timecard.css");    page.addToBody(form);    page.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("EmptyForm.html", buffer.toString());    assertEquals("EmptyForm", true, match);  }  public void testForm() throws IOException  {    StringBuffer buffer = new StringBuffer();    SimpleInputFormProducer form = new SimpleInputFormProducer("Login", "Please enter your username and password.", "Press the Button", "./noservlet");    form.addField("Name", "name", "Fred");    form.addMaskedField("Password", "password", "");    form.addField("Rank", "rank", "");    form.addField("SerialNumber", "serialNumber", null);    PagePrimitive page = new PagePrimitive("test", "../Timecard.css");    page.addToBody(form);    page.buildContent(buffer);    boolean match = testFileSet.fileMatchesGold("Form.html", buffer.toString());    assertEquals("Form", true, match);  }  public static void main(String args[])  {    junit.textui.TestRunner.run(TestSimpleInputFormProducer.class);  }}

⌨️ 快捷键说明

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