?? testsimpleinputformproducer.java
字號:
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -