1 23 24 28 29 package com.sun.enterprise.tools.common.validation.util; 30 31 import java.io.File ; 32 33 import junit.framework.*; 34 35 import com.sun.enterprise.tools.common.validation.Constants; 36 import com.sun.enterprise.tools.common.validation.util.Utils; 37 38 39 44 45 public class BundleReaderTest extends TestCase{ 46 47 48 public BundleReaderTest(String name){ 49 super(name); 50 } 51 52 53 public static void main(String args[]){ 54 junit.textui.TestRunner.run(suite()); 55 } 56 57 58 public void testGetValue() { 59 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")); } 64 65 66 public void testCreate() { 67 String bundleFile = "com/sun/enterprise/tools/" + "common/validation/Bundle.properties"; Utils utils = new Utils(); 70 boolean fileExists = utils.fileExists(bundleFile); 71 String str = 72 BundleReader.getValue("MSG_NumberConstraint_Failure"); 74 if(fileExists){ 75 assertTrue(!str.equals("MSG_NumberConstraint_Failure")); } else { 77 assertTrue(str.equals("MSG_NumberConstraint_Failure")); } 79 } 80 81 82 85 public static Test suite(){ 86 TestSuite suite = new TestSuite(BundleReaderTest.class); 87 return suite; 88 } 89 90 91 94 protected void setUp() { 95 } 96 97 98 101 protected void tearDown() { 102 } 103 104 105 private void nyi() { 106 fail("Not yet implemented"); } 108 } 109 | Popular Tags |