private TestArg0(GeneratedHttpRequest in) { this.setContext(in); } }
private TestCallerArg0(GeneratedHttpRequest in) { this.setContext(in); } }
@Override protected Function<Object, IterableWithMarker<T>> markerToNextForArgs(List<Object> args) { Optional<Object> arg0 = Optional.fromNullable(args.size() > 0 ? args.get(0) : null); return markerToNextForArg0(arg0); }
@Override public PagedIterable<T> apply(IterableWithMarker<T> input) { return input.nextMarker().isPresent() ? advance(input, markerToNextForArgs(getArgs(request))) : onlyPage(input); }
@Override public PagedIterable<T> apply(IterableWithMarker<T> input) { if (!input.nextMarker().isPresent()) return onlyPage(input); List<Object> args = getArgs(request); Optional<Object> arg0 = Optional.fromNullable(args.size() > 0 ? args.get(0) : null); return advance(input, markerToNextForArg0(arg0)); }
@Test public void testWhenNextMarkerAbsentDoesntAdvance() { GeneratedHttpRequest request = args(ImmutableList.of()); TestArg0 converter = new TestArg0(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArg0(Optional<Object> arg0) { fail(); return null; } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"))).concat().toSet(), ImmutableSet.of("foo", "bar")); }
@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")); }
private TestCallerArgs(GeneratedHttpRequest in) { this.setContext(in); } }
private TestArgs(GeneratedHttpRequest in) { this.setContext(in); } }
@Override public PagedIterable<T> apply(IterableWithMarker<T> input) { return input.nextMarker().isPresent() ? advance(input, markerToNextForArgs(getArgs(request))) : onlyPage(input); }
@Override protected Function<Object, IterableWithMarker<T>> markerToNextForArgs(List<Object> args) { Optional<Object> arg0 = Optional.fromNullable(!args.isEmpty() ? args.get(0) : null); return markerToNextForArg0(arg0); }
@Test public void testWhenNextMarkerPresentWithArgsMarkerToNextForArg0ParamIsPresent() { GeneratedHttpRequest request = args(ImmutableList.<Object> of("path")); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestArg0 converter = new TestArg0(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")); }
private TestArg0(GeneratedHttpRequest in) { this.setContext(in); } }
private TestCallerArg0(GeneratedHttpRequest in) { this.setContext(in); } }
@Override public PagedIterable<T> apply(IterableWithMarker<T> input) { return input.nextMarker().isPresent() ? advance(input, markerToNextForArgs(getArgs(request))) : onlyPage(input); }
@Override protected Function<Object, IterableWithMarker<T>> markerToNextForArgs(List<Object> args) { Optional<Object> arg0 = Optional.fromNullable(!args.isEmpty() ? args.get(0) : null); return markerToNextForArg0(arg0); }
@Test public void testWhenNextMarkerPresentButNoArgsMarkerToNextForArg0ParamIsAbsent() { GeneratedHttpRequest request = args(ImmutableList.of()); final IterableWithMarker<String> next = IterableWithMarkers.from(ImmutableSet.of("baz")); TestArg0 converter = new TestArg0(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")); }
@Override public PagedIterable<T> apply(IterableWithMarker<T> input) { return input.nextMarker().isPresent() ? advance(input, markerToNextForArgs(getArgs(request))) : onlyPage(input); }
@Override protected Function<Object, IterableWithMarker<T>> markerToNextForArgs(List<Object> args) { Optional<Object> arg0 = Optional.fromNullable(!args.isEmpty() ? args.get(0) : null); return markerToNextForArg0(arg0); }