@Test public void canGetByUrlAndOptionalOptions() { List<Document> expectedResult = ImmutableList.of(new Document()); when(dao.getByUrl(url, Optional.of(fromLocale.getLocaleCode()), Optional.of(toLocale.getLocaleCode()), Optional.empty())).thenReturn( expectedResult); List<Document> docs = service.getByUrl(url, Optional.of(fromLocale.getLocaleCode()), Optional.of(toLocale.getLocaleCode()), Optional.empty()); verify(dao).getByUrl(url, Optional.of(fromLocale.getLocaleCode()), Optional.of(toLocale.getLocaleCode()), Optional.empty()); assertThat(docs).isSameAs(expectedResult); }
@Transactional public List<Document> getByUrl(@NotNull String url, Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode, Optional<DateRange> dateParam) { return documentDAO.getByUrl(url, fromLocaleCode, toLocaleCode, dateParam); }
DocumentService { @Transactional public List<Document> getByUrl(@NotNull String url, Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode, Optional<DateRange> dateParam) { return documentDAO.getByUrl(url, fromLocaleCode, toLocaleCode, dateParam); } }
DocumentService { @Transactional public List<Document> getByUrl(@NotNull String url, Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode, Optional<DateRange> dateParam) { return documentDAO.getByUrl(url, fromLocaleCode, toLocaleCode, dateParam); } @Inject  DocumentService(DocumentDAO documentDAO); @SuppressWarnings("unused")  DocumentService(); }
DocumentService { @Transactional public List<Document> getByUrl(@NotNull String url, Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode, Optional<DateRange> dateParam) { return documentDAO.getByUrl(url, fromLocaleCode, toLocaleCode, dateParam); } @Inject  DocumentService(DocumentDAO documentDAO); @SuppressWarnings("unused")  DocumentService(); @Transactional Document getOrCreateByUrl(String url, Locale fromLocale, Locale toLocale); @Transactional List<Document> getByUrl(@NotNull String url,
            Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode,
            Optional<DateRange> dateParam); @Transactional Document incrementDocRequestCount(Document doc); }
DocumentService { @Transactional public List<Document> getByUrl(@NotNull String url, Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode, Optional<DateRange> dateParam) { return documentDAO.getByUrl(url, fromLocaleCode, toLocaleCode, dateParam); } @Inject  DocumentService(DocumentDAO documentDAO); @SuppressWarnings("unused")  DocumentService(); @Transactional Document getOrCreateByUrl(String url, Locale fromLocale, Locale toLocale); @Transactional List<Document> getByUrl(@NotNull String url,
            Optional<LocaleCode> fromLocaleCode, Optional<LocaleCode> toLocaleCode,
            Optional<DateRange> dateParam); @Transactional Document incrementDocRequestCount(Document doc);  }