### Question:
Path { public boolean matches(String toMatch) { return matches(new Path(toMatch)); } Path();  Path(Path path);  Path(String... part);  Path(List<String> parts); List<String> parts(); String first(); String last(); String get(int index); void add(String parts); String remove(int index); boolean startsWith(List<String> partsToMatch); int size(); String toString(); boolean equals(Object o); Path subpath(int fromIndex, int toIndex); boolean isStatic(int index); boolean isWildcard(int index); boolean isVar(int index); String getVarName(int index); boolean isOptional(int index); boolean matches(String toMatch); boolean matches(Path concretePath); Path extract(Map params, Path toMatch); Path extract(Map params, Path matchingConcretePath, boolean greedy);  }### Answer:
@Test public void match() { assertTrue(new Path("[{^$}]").matches("")); assertTrue(new Path("*").matches("/something/asdfas/")); assertTrue(new Path("*").matches("something/asdfas/")); assertTrue(new Path("something/{collection:books|customers}").matches("something/books")); assertTrue(new Path("something/{collection:books|customers}").matches("something/Books")); assertTrue(new Path("something/{collection:books|customers}").matches("something/customers")); assertFalse(new Path("somsething/{collection:books|customers}").matches("something/blah")); assertTrue(new Path("something/{collection:books|customers}/*").matches("something/customers/1234")); assertTrue(new Path("something/{collection:books|customers}/{resource:[0-9a-fA-F]{1,8}}").matches("something/customers/11111111")); assertTrue(new Path("something/{collection:books|customers}/{resource:[0-9a-fA-F]{1,8}}").matches("something/customers/aaaaaaaa")); assertFalse(new Path("something/{collection:books|customers}/{resource:[0-9a-fA-F]{1,8}}").matches("something/customers/aaaaaaaaaa")); assertFalse(new Path("something/{collection:books|customers}/{resource:[0-9a-fA-F]{1,8}}").matches("something/customers/1111111111")); assertFalse(new Path("something/{collection:books|customers}/{resource:[0-9a-fA-F]{1,8}}").matches("something/customers/zzzzzzzz")); assertTrue(new Path("something/{collection:books|customers}/{resource:[0-9]{1,8}}/{relationship:[a-zA-Z]*}").matches("something/customers/1234/orders")); assertTrue(new Path("something/{collection:books|customers}/{resource:[0-9]{1,8}}/{relationship:[a-zA-Z]*}").matches("something/customers/1234/orders/")); assertTrue(new Path("something/{collection:books|customers}/[{resource:[0-9]{1,8}}]/[{relationship:[a-zA-Z]*}]").matches("something/customers/1234/")); assertFalse(new Path("something/{collection:books|customers}/{resource:[0-9]{1,8}}/{relationship:[a-zA-Z]*}").matches("something/customers/1234/")); assertTrue(new Path("{collection:players|locations|ads}/[{resource:[0-9]{1,12}}]/{relationship:[a-z]*}").matches("Locations/698/players")); }