@Test public void getShouldReturnThePathValuesWhenPresent() { Path path = new Path("/foo/bar/", new PathParam(new PathParamName("fst"), "foo"), new PathParam(new PathParamName("snd"), "bar")); Optional<String> fst = path.get("fst"); Optional<String> snd = path.get("snd"); Optional<String> qux = path.get("qux"); assertEquals(Optional.of("foo"), fst); assertEquals(Optional.of("bar"), snd); assertEquals(Optional.<String>empty(), qux); }
public Optional<String> get(String key) { return Optional.ofNullable(valueFor(key)); }
Path { public Optional<String> get(String key) { return Optional.ofNullable(valueFor(key)); } }
Path { public Optional<String> get(String key) { return Optional.ofNullable(valueFor(key)); } Path(String rawPath, PathParam ... params); }
Path { public Optional<String> get(String key) { return Optional.ofNullable(valueFor(key)); } Path(String rawPath, PathParam ... params); String valueFor(String key); String valueFor(String key, String defaultValue); int size(); @Override String toString(); Optional<String> get(String key); String show(); boolean eq(Path that); }
Path { public Optional<String> get(String key) { return Optional.ofNullable(valueFor(key)); } Path(String rawPath, PathParam ... params); String valueFor(String key); String valueFor(String key, String defaultValue); int size(); @Override String toString(); Optional<String> get(String key); String show(); boolean eq(Path that);  }