예제 #1
0
파일: PropsTest.java 프로젝트: vtudiv/jodd
  @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
파일: PropsTest.java 프로젝트: vtudiv/jodd
 @Test
 public void testEscapeNewValue() throws IOException {
   Props p = new Props();
   p.setEscapeNewLineValue("<br>");
   p.load(readDataFile("test.props"));
   assertEquals(
       "Snow White, pursued by a jealous queen, hides with the Dwarfs; <br>the queen feeds her a poison apple, but Prince Charming <br>awakens her with a kiss.",
       p.getValue("plot"));
 }