1 19 20 package gui.propertyeditors; 21 22 import org.netbeans.jellytools.properties.editors.StringCustomEditorOperator; 23 24 import org.netbeans.junit.NbTestSuite; 25 26 27 32 public class PropertyType_String extends PropertyEditorsTest { 33 34 public String propertyName_L; 35 public String propertyValue_L; 36 37 38 public PropertyType_String(String testName) { 39 super(testName); 40 } 41 42 43 public void setUp(){ 44 propertyName_L = "String"; 45 super.setUp(); 46 } 47 48 public static NbTestSuite suite() { 49 NbTestSuite suite = new NbTestSuite(); 50 suite.addTest(new PropertyType_String("verifyCustomizer")); 51 suite.addTest(new PropertyType_String("testCustomizerCancel")); 52 suite.addTest(new PropertyType_String("testCustomizerOk")); 53 suite.addTest(new PropertyType_String("testByInPlace")); 54 return suite; 55 } 56 57 public void testCustomizerOk() { 58 propertyValue_L = "My String - ok"; 59 setByCustomizerOk(propertyName_L, true); 60 } 61 62 public void testCustomizerCancel(){ 63 propertyValue_L = "My String - cancel"; 64 setByCustomizerCancel(propertyName_L, false); 65 } 66 67 public void testByInPlace(){ 68 propertyValue_L = "My String - in-place"; 69 setByInPlace(propertyName_L, propertyValue_L, true); 70 } 71 72 public void verifyCustomizer() { 73 verifyCustomizer(propertyName_L); 74 } 75 76 public void setCustomizerValue() { 77 StringCustomEditorOperator customizer = new StringCustomEditorOperator(propertyCustomizer); 78 customizer.setStringValue(propertyValue_L); 79 } 80 81 public void verifyPropertyValue(boolean expectation) { 82 String newValue = getValue(propertyName_L); 83 84 if( ( !newValue.equals(propertyInitialValue) && propertyValue_L.equals(newValue) ) && expectation) { 85 log("New value is {"+newValue+"} and old value is{"+propertyInitialValue+"} - expactation is {"+expectation+"} --> PASS"); 86 }else if ( newValue.equals(propertyInitialValue) && !propertyValue_L.equals(newValue) && !expectation ) { 87 log("New value is {"+newValue+"} and old value is{"+propertyInitialValue+"} - expactation is {"+expectation+"} --> PASS"); 88 }else { 89 fail("New value is {"+newValue+"} and old value is{"+propertyInitialValue+"} - expactation is {"+expectation+"} --> FAIL"); 90 } 91 } 92 93 public void verifyCustomizerLayout() { 94 StringCustomEditorOperator customizer = new StringCustomEditorOperator(propertyCustomizer); 95 customizer.verify(); 96 customizer.btOK(); 97 customizer.btCancel(); 98 } 99 100 103 public static void main(String [] args) { 104 junit.textui.TestRunner.run(suite()); 106 } 107 108 } 109 | Popular Tags |