?? testtextboxprimitive.java
字號:
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.Core.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements.*;import java.io.*;public class TestTextBoxPrimitive extends TestCase{ private TestFileSet testFileSet; public TestTextBoxPrimitive(String name) throws IOException { super(name); testFileSet = new TestFileSet("C:/EJwithUML2e/UnitTestResults/HtmlPrimitives/FormPrimitives/TextBoxPrimitive/"); } public static void main(String[] args) { junit.textui.TestRunner.run(TestTextBoxPrimitive.class); } public void testSimpleTextBox() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("SimpleTextBox.html", buffer.toString()); assertEquals("SimpleTextBox", match, true); } public void testTextBoxWithInitialValue() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setInitialValue("Pink Floyd"); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("WithInitialValue.html", buffer.toString()); assertEquals("WithInitialValue", match, true); } public void testTextBoxWithMasking() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setMasked(); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("WithMasking.html", buffer.toString()); assertEquals("WithMasking", match, true); } public void testHidden() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setHidden(); text_box.setInitialValue("secret band"); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("Hidden.html", buffer.toString()); assertEquals("Hidden", match, true); } public void testFiniteWidthAndCapacity() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setMaximumLength(10); text_box.setWidth(5); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("FiniteWidthAndCapacity.html", buffer.toString()); assertEquals("FiniteWidthAndCapacity", match, true); } public void testReadOnly() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setReadOnly(); text_box.setInitialValue("you can't change this"); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("ReadOnly.html", buffer.toString()); assertEquals("ReadOnly", match, true); } public void testWithStyle() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setStyle(Style.NORMAL_TEXT); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("WithStyle.html", buffer.toString()); assertEquals("WithStyle", match, true); } public void testWithAlmostEverything() throws IOException { StringBuffer buffer = new StringBuffer(); TextBoxPrimitive text_box = new TextBoxPrimitive("favoriteBand"); text_box.setStyle(Style.NORMAL_TEXT); text_box.setInitialValue("Pink Floyd"); text_box.setMaximumLength(10); text_box.setWidth(5); text_box.setMasked(); text_box.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("WithAlmostEverything.html", buffer.toString()); assertEquals("WithAlmostEverything", match, true); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -