@Test public void shouldAppendFieldNameWithoutDotOnEmptyOrNullCurrentPath() throws Exception { String currentPath = ""; String currentPath2 = null; String path = PathBuilder.appendTo(currentPath, "address"); String path2 = PathBuilder.appendTo(currentPath2, "product"); assertEquals("address", path); assertEquals("product", path2); }
public static String appendTo(String current, int index) { if (!StringUtils.hasText(current)) throw new IllegalArgumentException("Current path connot be null or empty"); return String.format(COLLECTION_FORMAT, current, index); }
PathBuilder { public static String appendTo(String current, int index) { if (!StringUtils.hasText(current)) throw new IllegalArgumentException("Current path connot be null or empty"); return String.format(COLLECTION_FORMAT, current, index); } }
PathBuilder { public static String appendTo(String current, int index) { if (!StringUtils.hasText(current)) throw new IllegalArgumentException("Current path connot be null or empty"); return String.format(COLLECTION_FORMAT, current, index); } private  PathBuilder(); }
PathBuilder { public static String appendTo(String current, int index) { if (!StringUtils.hasText(current)) throw new IllegalArgumentException("Current path connot be null or empty"); return String.format(COLLECTION_FORMAT, current, index); } private  PathBuilder(); static String appendTo(String current, int index); static String appendToMap(String current, String key); static String appendTo(String current, String fieldName); }
PathBuilder { public static String appendTo(String current, int index) { if (!StringUtils.hasText(current)) throw new IllegalArgumentException("Current path connot be null or empty"); return String.format(COLLECTION_FORMAT, current, index); } private  PathBuilder(); static String appendTo(String current, int index); static String appendToMap(String current, String key); static String appendTo(String current, String fieldName);  }