1 19 20 package org.netbeans.modules.j2ee.sun.validation.util; 21 22 import java.io.File ; 23 24 import junit.framework.*; 25 26 import org.netbeans.modules.j2ee.sun.validation.Constants; 27 import org.netbeans.modules.j2ee.sun.validation.util.Utils; 28 29 30 35 36 public class BundleReaderTest extends TestCase{ 37 38 39 public BundleReaderTest(String name){ 40 super(name); 41 } 42 43 44 public static void main(String args[]){ 45 junit.textui.TestRunner.run(suite()); 46 } 47 48 49 public void testGetValue() { 50 String str = BundleReader.getValue("non_existing_key"); assertTrue(str.equals("non_existing_key")); str = BundleReader.getValue("MSG_NumberConstraint_Failure"); assertTrue(!str.equals("MSG_NumberConstraint_Failure")); } 55 56 57 public void testCreate() { 58 String bundleFile = "org/netbeans/modules/" + "j2ee/sun/validation/Bundle.properties"; Utils utils = new Utils(); 61 boolean fileExists = utils.fileExists(bundleFile); 62 String str = 63 BundleReader.getValue("MSG_NumberConstraint_Failure"); 65 if(fileExists){ 66 assertTrue(!str.equals("MSG_NumberConstraint_Failure")); } else { 68 assertTrue(str.equals("MSG_NumberConstraint_Failure")); } 70 } 71 72 73 76 public static Test suite(){ 77 TestSuite suite = new TestSuite(BundleReaderTest.class); 78 return suite; 79 } 80 81 82 85 protected void setUp() { 86 } 87 88 89 92 protected void tearDown() { 93 } 94 95 96 private void nyi() { 97 } 99 } 100 | Popular Tags |