@Test public void canQueryMTRequests() { DateRange dateRange = DateRange.fromString("2018-05-01..2018-05-31"); Account account = new Account(); Locale toLocale = new Locale(LocaleCode.ZH_HANS, "Simplified Chinese"); Locale fromLocale = new Locale(LocaleCode.EN_US, "English"); int charCount = 10; int wordCount = 4; when(requestDAO.getRequestsByDateRange(dateRange, account)) .thenReturn(ImmutableList.of( new TextFlowMTRequest(BackendID.DEV, new Date(), new Document("https: toLocale), account, ImmutableList.of("abc"), wordCount, charCount))); List<MTRequestStatistics> requestStats = service.getMTRequestStats(account, dateRange); assertThat(requestStats).hasSize(1); MTRequestStatistics stats = requestStats.get(0); assertThat(stats.getCharCount()).isEqualTo(charCount); assertThat(stats.getWordCount()).isEqualTo(wordCount); assertThat(stats.getDocUrl()).isEqualTo("https: }
public List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull DateRange dateRange) { List<TextFlowMTRequest> requestsByDateRange = textFlowMTRequestDAO.getRequestsByDateRange(dateRange, account); return requestsByDateRange.stream().map(request -> { Document document = request.getDocument(); LocaleCode fromLocaleCode = document.getFromLocale().getLocaleCode(); LocaleCode toLocaleCode = document.getToLocale().getLocaleCode(); return new MTRequestStatistics(fromLocaleCode.getId(), toLocaleCode.getId(), document.getUrl(), request.getCharCount(), request.getWordCount(), request.getBackendID()); }).collect(Collectors.toList()); }
ReportingService { public List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull DateRange dateRange) { List<TextFlowMTRequest> requestsByDateRange = textFlowMTRequestDAO.getRequestsByDateRange(dateRange, account); return requestsByDateRange.stream().map(request -> { Document document = request.getDocument(); LocaleCode fromLocaleCode = document.getFromLocale().getLocaleCode(); LocaleCode toLocaleCode = document.getToLocale().getLocaleCode(); return new MTRequestStatistics(fromLocaleCode.getId(), toLocaleCode.getId(), document.getUrl(), request.getCharCount(), request.getWordCount(), request.getBackendID()); }).collect(Collectors.toList()); } }
ReportingService { public List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull DateRange dateRange) { List<TextFlowMTRequest> requestsByDateRange = textFlowMTRequestDAO.getRequestsByDateRange(dateRange, account); return requestsByDateRange.stream().map(request -> { Document document = request.getDocument(); LocaleCode fromLocaleCode = document.getFromLocale().getLocaleCode(); LocaleCode toLocaleCode = document.getToLocale().getLocaleCode(); return new MTRequestStatistics(fromLocaleCode.getId(), toLocaleCode.getId(), document.getUrl(), request.getCharCount(), request.getWordCount(), request.getBackendID()); }).collect(Collectors.toList()); } ReportingService(); @Inject  ReportingService(TextFlowMTRequestDAO textFlowMTRequestDAO); }
ReportingService { public List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull DateRange dateRange) { List<TextFlowMTRequest> requestsByDateRange = textFlowMTRequestDAO.getRequestsByDateRange(dateRange, account); return requestsByDateRange.stream().map(request -> { Document document = request.getDocument(); LocaleCode fromLocaleCode = document.getFromLocale().getLocaleCode(); LocaleCode toLocaleCode = document.getToLocale().getLocaleCode(); return new MTRequestStatistics(fromLocaleCode.getId(), toLocaleCode.getId(), document.getUrl(), request.getCharCount(), request.getWordCount(), request.getBackendID()); }).collect(Collectors.toList()); } ReportingService(); @Inject  ReportingService(TextFlowMTRequestDAO textFlowMTRequestDAO); List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull
            DateRange dateRange); }
ReportingService { public List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull DateRange dateRange) { List<TextFlowMTRequest> requestsByDateRange = textFlowMTRequestDAO.getRequestsByDateRange(dateRange, account); return requestsByDateRange.stream().map(request -> { Document document = request.getDocument(); LocaleCode fromLocaleCode = document.getFromLocale().getLocaleCode(); LocaleCode toLocaleCode = document.getToLocale().getLocaleCode(); return new MTRequestStatistics(fromLocaleCode.getId(), toLocaleCode.getId(), document.getUrl(), request.getCharCount(), request.getWordCount(), request.getBackendID()); }).collect(Collectors.toList()); } ReportingService(); @Inject  ReportingService(TextFlowMTRequestDAO textFlowMTRequestDAO); List<MTRequestStatistics> getMTRequestStats(Account account, @Nonnull
            DateRange dateRange);  }