@Test public void testFromCallerWhenNextMarkerPresentWithArgsMarkerToNextForArg0ParamIsPresent() { GeneratedHttpRequest request = callerArgs(ImmutableList.<Object> of("path")); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestCallerArg0 converter = new TestCallerArg0(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArg0(Optional<Object> arg0) { assertEquals(arg0, Optional.of("path")); return Functions.constant(next); } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "marker")).concat().toSet(), ImmutableSet.of("foo", "bar", "baz")); }
@Test public void testFromCallerWhenNextMarkerPresentButNoArgsMarkerToNextForArg0ParamIsAbsent() { GeneratedHttpRequest request = callerArgs(ImmutableList.of()); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestCallerArg0 converter = new TestCallerArg0(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArg0(Optional<Object> arg0) { assertEquals(arg0, Optional.absent()); return Functions.constant(next); } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "marker")).concat().toSet(), ImmutableSet.of("foo", "bar", "baz")); }
@Test public void testFromCallerWhenNextMarkerPresentButNoArgsMarkerToNextForArg0ParamIsAbsent() { GeneratedHttpRequest request = callerArgs(ImmutableList.of()); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestCallerArg0 converter = new TestCallerArg0(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArg0(Optional<Object> arg0) { assertEquals(arg0, Optional.absent()); return Functions.constant(next); } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "marker")).concat().toSet(), ImmutableSet.of("foo", "bar", "baz")); }
@Test public void testFromCallerWhenNextMarkerPresentWithArgsMarkerToNextForArg0ParamIsPresent() { GeneratedHttpRequest request = callerArgs(ImmutableList.<Object> of("path")); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestCallerArg0 converter = new TestCallerArg0(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArg0(Optional<Object> arg0) { assertEquals(arg0, Optional.of("path")); return Functions.constant(next); } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "marker")).concat().toSet(), ImmutableSet.of("foo", "bar", "baz")); }