示例#1
0
  @Test
  public void testValueWithBracket() throws IOException {
    Props p = new Props();
    p.load(readDataFile("test3.props"));

    assertEquals("[email protected];[email protected]", p.getValue("email.from"));
    assertEquals("[ERROR] Got %s exceptions", p.getValue("email.subject"));
    assertEquals("line1line2line3", p.getValue("email.text"));

    p = new Props();
    p.setIgnorePrefixWhitespacesOnNewLine(false);
    p.load(readDataFile("test3.props"));

    assertEquals("[email protected];[email protected]", p.getValue("email.from"));
    assertEquals("[ERROR] Got %s exceptions", p.getValue("email.subject"));
    assertEquals("line1\tline2line3", p.getValue("email.text"));

    p = new Props();
    p.setIgnorePrefixWhitespacesOnNewLine(false);
    p.setEscapeNewLineValue("\n");
    p.load(readDataFile("test3.props"));

    assertEquals("[email protected];[email protected]", p.getValue("email.from"));
    assertEquals("[ERROR] Got %s exceptions", p.getValue("email.subject"));
    assertEquals("line1\n\tline2\nline3", p.getValue("email.text"));
  }
示例#2
0
 @Test
 public void testIgnorePrefixWhitespace() throws IOException {
   Props p = new Props();
   p.setIgnorePrefixWhitespacesOnNewLine(false);
   p.load(readDataFile("test.props"));
   assertEquals(
       "Snow White, pursued by a jealous queen, hides with the Dwarfs; \t\tthe queen feeds her a poison apple, but Prince Charming \t\tawakens her with a kiss.",
       p.getValue("plot"));
 }