@Test void shouldFindEmptyIfListContainsTwoDifferentIds() { ByIdResultSelector selector = new ByIdResultSelector("1"); List<ResultAction> resultActions = new ArrayList<>(); resultActions.add(createResultActionStub("2")); resultActions.add(createResultActionStub("3")); Run<?, ?> run = createRunStub(resultActions); assertThat(selector.get(run)).isEmpty(); }
@Override public Optional<ResultAction> get(final Run<?, ?> build) { List<ResultAction> actions = build.getActions(ResultAction.class); for (ResultAction action : actions) { if (id.equals(action.getId())) { return Optional.of(action); } } return Optional.empty(); }
ByIdResultSelector implements ResultSelector { @Override public Optional<ResultAction> get(final Run<?, ?> build) { List<ResultAction> actions = build.getActions(ResultAction.class); for (ResultAction action : actions) { if (id.equals(action.getId())) { return Optional.of(action); } } return Optional.empty(); } }
ByIdResultSelector implements ResultSelector { @Override public Optional<ResultAction> get(final Run<?, ?> build) { List<ResultAction> actions = build.getActions(ResultAction.class); for (ResultAction action : actions) { if (id.equals(action.getId())) { return Optional.of(action); } } return Optional.empty(); } ByIdResultSelector(final String id); }
ByIdResultSelector implements ResultSelector { @Override public Optional<ResultAction> get(final Run<?, ?> build) { List<ResultAction> actions = build.getActions(ResultAction.class); for (ResultAction action : actions) { if (id.equals(action.getId())) { return Optional.of(action); } } return Optional.empty(); } ByIdResultSelector(final String id); @Override Optional<ResultAction> get(final Run<?, ?> build); @Override String toString(); }
ByIdResultSelector implements ResultSelector { @Override public Optional<ResultAction> get(final Run<?, ?> build) { List<ResultAction> actions = build.getActions(ResultAction.class); for (ResultAction action : actions) { if (id.equals(action.getId())) { return Optional.of(action); } } return Optional.empty(); } ByIdResultSelector(final String id); @Override Optional<ResultAction> get(final Run<?, ?> build); @Override String toString();  }