@Test public void testMapToTextUnitsFromPluralsDocument() { String locale = "pt-BR"; String repo = "brazil"; mapper = new AndroidStringDocumentMapper("_", assetDelimiter, locale, repo); document = new AndroidStringDocument(); AndroidPlural.AndroidPluralBuilder builder1 = AndroidPlural.builder(); builder1.setComment("comment1"); builder1.setName("string/path1#@#name1"); builder1.addItem(new AndroidPluralItem(10L, ONE, "one1_content")); builder1.addItem(new AndroidPluralItem(11L, MANY, "many1_content")); document.addPlural(builder1.build()); AndroidPlural.AndroidPluralBuilder builder2 = AndroidPlural.builder(); builder2.setComment("comment2"); builder2.setName("string/path2#@#name2"); builder2.addItem(new AndroidPluralItem(21L, ONE, "one2_content")); builder2.addItem(new AndroidPluralItem(22L, TWO, "two2_content")); builder2.addItem(new AndroidPluralItem(23L, MANY, "many2_content")); document.addPlural(builder2.build()); AndroidPlural.AndroidPluralBuilder builder3 = AndroidPlural.builder(); builder3.setComment("comment3"); builder3.setName("string/path3#@#name3"); builder3.addItem(new AndroidPluralItem(30L, ZERO, "zero3_content")); builder3.addItem(new AndroidPluralItem(31L, ONE, "one3_content")); builder3.addItem(new AndroidPluralItem(32L, TWO, "two3_content")); builder3.addItem(new AndroidPluralItem(33L, FEW, "few3_content")); builder3.addItem(new AndroidPluralItem(34L, MANY, "many3_content")); builder3.addItem(new AndroidPluralItem(35L, OTHER, "other3_content")); document.addPlural(builder3.build()); textUnits = mapper.mapToTextUnits(document); assertThat(textUnits).hasSize(11); assertThat(textUnits) .extracting("tmTextUnitId", "name", "pluralForm", "assetPath", "target", "targetLocale", "repositoryName") .contains(tuple(10L, "name1_one", "one", "string/path1", "one1_content", locale, repo)) .contains(tuple(11L, "name1_many", "many", "string/path1", "many1_content", locale, repo)) .contains(tuple(21L, "name2_one", "one", "string/path2", "one2_content", locale, repo)) .contains(tuple(22L, "name2_two", "two", "string/path2", "two2_content", locale, repo)) .contains(tuple(23L, "name2_many", "many", "string/path2", "many2_content", locale, repo)) .contains(tuple(30L, "name3_zero", "zero", "string/path3", "zero3_content", locale, repo)) .contains(tuple(31L, "name3_one", "one", "string/path3", "one3_content", locale, repo)) .contains(tuple(32L, "name3_two", "two", "string/path3", "two3_content", locale, repo)) .contains(tuple(33L, "name3_few", "few", "string/path3", "few3_content", locale, repo)) .contains(tuple(34L, "name3_many", "many", "string/path3", "many3_content", locale, repo)) .contains(tuple(35L, "name3_other", "other", "string/path3", "other3_content", locale, repo)); }
public List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document) { return mapToTextUnitStream(document).collect(Collectors.toList()); }
AndroidStringDocumentMapper { public List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document) { return mapToTextUnitStream(document).collect(Collectors.toList()); } }
AndroidStringDocumentMapper { public List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document) { return mapToTextUnitStream(document).collect(Collectors.toList()); } AndroidStringDocumentMapper(String pluralSeparator,
                                       String assetDelimiter,
                                       String locale,
                                       String repositoryName);  AndroidStringDocumentMapper(String pluralSeparator, String assetDelimiter); }
AndroidStringDocumentMapper { public List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document) { return mapToTextUnitStream(document).collect(Collectors.toList()); } AndroidStringDocumentMapper(String pluralSeparator,
                                       String assetDelimiter,
                                       String locale,
                                       String repositoryName);  AndroidStringDocumentMapper(String pluralSeparator, String assetDelimiter); AndroidStringDocument readFromTextUnits(List<TextUnitDTO> textUnits, boolean useSource); AndroidStringDocument readFromSourceTextUnits(List<TextUnitDTO> textUnits); AndroidStringDocument readFromTargetTextUnits(List<TextUnitDTO> textUnits); List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document); Stream<TextUnitDTO> mapToTextUnitStream(AndroidStringDocument document); }
AndroidStringDocumentMapper { public List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document) { return mapToTextUnitStream(document).collect(Collectors.toList()); } AndroidStringDocumentMapper(String pluralSeparator,
                                       String assetDelimiter,
                                       String locale,
                                       String repositoryName);  AndroidStringDocumentMapper(String pluralSeparator, String assetDelimiter); AndroidStringDocument readFromTextUnits(List<TextUnitDTO> textUnits, boolean useSource); AndroidStringDocument readFromSourceTextUnits(List<TextUnitDTO> textUnits); AndroidStringDocument readFromTargetTextUnits(List<TextUnitDTO> textUnits); List<TextUnitDTO> mapToTextUnits(AndroidStringDocument document); Stream<TextUnitDTO> mapToTextUnitStream(AndroidStringDocument document);  }