PropertyUtil { public static String getProperty(String key) { String result = props.get(key); if (result != null && result.equals("@" + key)) { return result; } if (result != null && result.startsWith("@@")) { return result.substring(1); } if (result != null && result.startsWith("@")) { result = getProperty(result.substring(1)); } return result; }  static synchronized void addPropertyFile(String name); static String getProperty(String key); static String getProperty(String key, String defaultValue); static Enumeration<String> getPropertyNames(); static Enumeration<String> getPropertyNames(String keyPrefix); static Set<?> getPropertiesValues(String propertyName,
            String keyPrefix); static Enumeration<String> getPropertyNames(Properties localProps,
            String keyPrefix); static Set<String> getPropertiesValues(Properties localProps,
            Enumeration<String> propertyNames); static Properties loadProperties(String propertyName); static final String DEFAULT_PROPERTY_FILE; }
@Test public void testGetPropertyString01() throws Exception { String input = "property.test001.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("test", str); }
@Test public void testGetPropertyString02() throws Exception { String input = "property.test001.id.1"; String str = PropertyUtil.getProperty(input); assertNull(str); }
@Test public void testGetPropertyString03() throws Exception { String input = null; try { PropertyUtil.getProperty(input); fail(); } catch (NullPointerException e) { return; } }
@Test public void testGetPropertyString04() throws Exception { String input = ""; String str = PropertyUtil.getProperty(input); assertNull(str); }
@Test public void testGetPropertyString05() throws Exception { String input = "property.test003.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("", str); }
@Test public void testGetPropertyString06() throws Exception { String input = "property.test004.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("testB", str); }
@Test public void testGetPropertyString07() throws Exception { String input = "@property.test0"; String str = PropertyUtil.getProperty(input); assertEquals("testtest", str); }
@Test public void testGetPropertyString08() throws Exception { String input = "property.test100.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("@property.test100.id.0", str); }
@Test public void testGetPropertyString09() throws Exception { String input = "property.test005"; String str = PropertyUtil.getProperty(input); assertEquals("test", str); }
@Test public void testGetPropertyString10() throws Exception { String input = "property.test007.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("@test007", str); }
@Test public void testGetPropertyString11() throws Exception { String input = "property.test008.id.0"; String str = PropertyUtil.getProperty(input); assertEquals("@", str); }
@Test public void testGetPropertyString12() throws Exception { String input = "property.test009.id.0"; String str = PropertyUtil.getProperty(input); assertNull(str); }
@Test public void testGetPropertyStringString01() throws Exception { String input1 = "property.test001.id.0"; String input2 = "default"; String str = PropertyUtil.getProperty(input1, input2); assertEquals("test", str); }
@Test public void testGetPropertyStringString02() throws Exception { String input1 = "property.test001.id.1"; String input2 = "default"; String str = PropertyUtil.getProperty(input1, input2); assertEquals("default", str); }
@Test public void testGetPropertyStringString03() throws Exception { String input1 = null; String input2 = "default"; try { PropertyUtil.getProperty(input1, input2); fail(); } catch (NullPointerException e) { return; } }
@Test public void testGetPropertyStringString04() throws Exception { String input1 = "property.test001.id.0"; String input2 = null; String str = PropertyUtil.getProperty(input1, input2); assertEquals("test", str); }
@Test public void testGetPropertyStringString05() throws Exception { String input1 = "property.test001.id.1"; String input2 = null; String str = PropertyUtil.getProperty(input1, input2); assertNull(str); }
@Test public void testGetPropertyStringString06() throws Exception { String input1 = ""; String input2 = "default"; String str = PropertyUtil.getProperty(input1, input2); assertEquals("default", str); }
@Test public void testGetPropertyStringString07() throws Exception { String input1 = "property.test001.id.0"; String input2 = ""; String str = PropertyUtil.getProperty(input1, input2); assertEquals("test", str); }
@Test public void testGetPropertyStringString08() throws Exception { String input1 = "property.test001.id.1"; String input2 = ""; String str = PropertyUtil.getProperty(input1, input2); assertEquals("", str); }
@Test public void testGetPropertyStringString09() throws Exception { String input1 = "property.test003.id.0"; String input2 = "default"; String str = PropertyUtil.getProperty(input1, input2); assertEquals("", str); }
@Test public void testGetPropertyStringString10() throws Exception { String input1 = "property.test004.id.0"; String input2 = "default"; String str = PropertyUtil.getProperty(input1, input2); assertEquals("testB", str); }
@Test public void testGetPropertiesPathStringString01() throws Exception { @SuppressWarnings("rawtypes") Class[] clz = new Class[] { String.class, String.class }; Object[] obj = new Object[] { "subDir/PropertyUtil.class", "hoge.txt" }; Method method = PropertyUtil.class.getDeclaredMethod( "getPropertiesPath", clz); method.setAccessible(true); Object retObj = method.invoke(PropertyUtil.class, obj); assertEquals("subDir" + System.getProperty("file.separator") + "hoge.txt", retObj); }
@Test public void testGetPropertiesPathStringString03() throws Exception { @SuppressWarnings("rawtypes") Class[] clz = new Class[] { String.class, String.class }; Object[] obj = new Object[] { "subDir/PropertyUtil.class", null }; Method method = PropertyUtil.class.getDeclaredMethod( "getPropertiesPath", clz); method.setAccessible(true); Object retObj = method.invoke(PropertyUtil.class, obj); assertEquals("subDir" + System.getProperty("file.separator") + "null", retObj); }