Added Unit Tests to increase code coverage (#2571)
This commit is contained in:
parent
24393f3b8d
commit
ac2cc7339d
|
|
@ -39,5 +39,18 @@ public class StringUtilTest {
|
|||
Assert.assertNull(StringUtil.join('.'));
|
||||
Assert.assertEquals("Single part.", StringUtil.join('.', "Single part."));
|
||||
Assert.assertEquals("part1.part2.p3", StringUtil.join('.', "part1", "part2", "p3"));
|
||||
Assert.assertEquals("E", StringUtil.join('E', new String[2]));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubstringMatchReturningTrue() {
|
||||
StringBuffer stringBuffer = new StringBuffer("ZP~>xz1;");
|
||||
Assert.assertTrue(StringUtil.substringMatch(stringBuffer, 0, stringBuffer));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubstringMatchWithPositive() {
|
||||
Assert.assertFalse(StringUtil.substringMatch("", 4770, ""));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -80,6 +80,19 @@ public class PropertyPlaceholderHelperTest {
|
|||
yaml.load(placeholderHelper.replacePlaceholders(properties.getProperty("restPort"), properties)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplacePlaceholders() {
|
||||
PropertyPlaceholderHelper propertyPlaceholderHelper = PropertyPlaceholderHelper.INSTANCE;
|
||||
Properties properties = new Properties();
|
||||
String resultString = propertyPlaceholderHelper.replacePlaceholders("&${[}7", properties);
|
||||
|
||||
Assert.assertEquals(0, properties.size());
|
||||
Assert.assertTrue(properties.isEmpty());
|
||||
|
||||
Assert.assertNotNull(resultString);
|
||||
Assert.assertEquals("&${[}7", resultString);
|
||||
}
|
||||
|
||||
@After
|
||||
public void afterTest() {
|
||||
//revert environment variables changes after the test for safe.
|
||||
|
|
|
|||
Loading…
Reference in New Issue