### Question:
StringUtil { public static final String substring(String line, String start, String end) { if ( line == null || line.length()<=0 ) { return null; } int beginIndex = 0; int endIndex = line.length(); if ( start != null ) { beginIndex = line.indexOf(start); if ( beginIndex >= 0 ) { beginIndex += start.length(); } else { beginIndex = 0; } } if ( end != null ) { endIndex = line.indexOf(end, beginIndex); if ( endIndex <= 0 ) { endIndex = line.length(); } else if ( endIndex <= beginIndex ) { return Constant.EMPTY; } } return line.substring(beginIndex, endIndex); }  static final String substring(String line, String start, String end); static final String substringR(String line, String start, String end); static final String concat(Object ... value ); static final int toInt(String str, int defaultValue); static final float toFloat(String str, float defaultValue); static final boolean checkNotEmpty(String str); static final void padStringRight(StringBuilder buf, String str, int length); static final String bytesToHexString(byte[] bytes); static final byte[] hexStringToBytes(String hexString); static final String[] splitMachineId(String machineId); static final Locale parseLocale(String languageTag, Locale defaultLocale); static final boolean checkValidEmail(String emailAddress); static String encryptSHA1(String data); static String encryptMD5(String data);  }### Answer:
@Test public void testSubstring1() { String line = "map1001={"; String start = "map"; String end = "="; String actual = StringUtil.substring(line, start, end); assertEquals("1001", actual); }
@Test public void testSubstring2() { String line = "map1001={"; String start = "mapZ"; String end = "="; String actual = StringUtil.substring(line, start, end); assertEquals("map1001", actual); }
@Test public void testSubstring3() { String line = "map1001={"; String start = "map"; String end = "=Z"; String actual = StringUtil.substring(line, start, end); assertEquals("1001={", actual); }
@Test public void testSubstring4() { String line = "map1001={"; String start = null; String end = "="; String actual = StringUtil.substring(line, start, end); assertEquals("map1001", actual); }
@Test public void testSubstring5() { String line = "map1001={"; String start = null; String end = null; String actual = StringUtil.substring(line, start, end); assertEquals("map1001={", actual); }
@Test public void testSubstring6() { String line = null; String start = "map"; String end = "="; String actual = StringUtil.substring(line, start, end); assertEquals(null, actual); }
@Test public void testSubstring8() { String line = "name=\"死亡沙漠\""; String start = "\""; String end = "\""; String actual = StringUtil.substring(line, start, end); assertEquals("死亡沙漠", actual); }
@Test public void testSubstring7() { String line = "map1001={"; String start = "map"; String end = "1001"; String actual = StringUtil.substring(line, start, end); assertEquals("", actual); }