@Test public void testBuildFromTextWithAllPlurals() throws Exception { text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<resources>\n" + "<!--testing plural-->\n" + "<plurals name=\"pins\">\n" + "<!--testing plural-->\n" + "<item quantity=\"zero\" tmTextUnitId=\"100\">0 Pins</item>\n" + "<item quantity=\"one\" tmTextUnitId=\"101\">1 Pin</item>\n" + "<item quantity=\"two\" tmTextUnitId=\"102\">2 Pins</item>\n" + "<item quantity=\"few\" tmTextUnitId=\"103\">3 Pins</item>\n" + "<item quantity=\"many\" tmTextUnitId=\"104\">4 Pins</item>\n" + "<item quantity=\"other\" tmTextUnitId=\"105\">{num_pins} Pins</item>\n" + "</plurals>\n" + "</resources>"; document = AndroidStringDocumentReader.fromText(text); assertThat(document).isNotNull(); assertThat(document.getSingulars()).hasSize(0); assertThat(document.getPlurals()).hasSize(1); AndroidPlural plural = document.getPlurals().get(0); assertThat(plural.getComment()).isEqualTo("testing plural"); assertThat(plural.getName()).isEqualTo("pins"); assertThat(plural.getItems()).hasSize(6); assertThat(plural.getItems().get(ZERO).getId()).isEqualTo(100L); assertThat(plural.getItems().get(ZERO).getContent()).isEqualTo("0 Pins"); assertThat(plural.getItems().get(ONE).getId()).isEqualTo(101L); assertThat(plural.getItems().get(ONE).getContent()).isEqualTo("1 Pin"); assertThat(plural.getItems().get(TWO).getId()).isEqualTo(102L); assertThat(plural.getItems().get(TWO).getContent()).isEqualTo("2 Pins"); assertThat(plural.getItems().get(FEW).getId()).isEqualTo(103L); assertThat(plural.getItems().get(FEW).getContent()).isEqualTo("3 Pins"); assertThat(plural.getItems().get(MANY).getId()).isEqualTo(104L); assertThat(plural.getItems().get(MANY).getContent()).isEqualTo("4 Pins"); assertThat(plural.getItems().get(OTHER).getId()).isEqualTo(105L); assertThat(plural.getItems().get(OTHER).getContent()).isEqualTo("{num_pins} Pins"); }
public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); } }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  static AndroidStringDocument fromFile(String fileName); static AndroidStringDocument fromText(String text); }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  static AndroidStringDocument fromFile(String fileName); static AndroidStringDocument fromText(String text);  }