### Question:
FieldPath implements Iterable<String> { public static FieldPath path(String path) { String[] pathElement = path.split("\\."); return new FieldPath(Arrays.asList(pathElement)); } private  FieldPath(Collection<String> path); static FieldPath path(String path); @Override Iterator<String> iterator(); Object injectLinks(Object target, HateoasLinkInjector<Object> injector, LinkProducer linkProducer,
                              HateoasVerbosity verbosity); @Override boolean equals(Object o); @Override int hashCode(); final static FieldPath EMPTY_PATH; }### Answer:
@Test public void testParse() { FieldPath tested = FieldPath.path("oneField.anotherField"); assertEquals(2, Iterables.size(tested)); assertEquals("oneField", Iterables.get(tested, 0)); assertEquals("anotherField", Iterables.get(tested, 1)); }
@Test public void verifyThatEmptySegmentIsRemoved() { FieldPath tested = FieldPath.path("oneField.anotherField."); assertEquals(2, Iterables.size(tested)); assertEquals("oneField", Iterables.get(tested, 0)); assertEquals("anotherField", Iterables.get(tested, 1)); }
@Test(expected = IllegalArgumentException.class) public void verifyThatBlankSegmentIsNotAllowed() { FieldPath tested = FieldPath.path("oneField..anotherField"); }
@Test(expected = IllegalArgumentException.class) public void verifyThatBlankSegmentIsNotAllowed2() { FieldPath tested = FieldPath.path("..oneField"); }