コード例 #1
0
  @Test
  public void testCreation_emptyVariables() {
    final Map<String, String> wordVariables = variables.getWordVariables();
    assertEquals(0, wordVariables.size());

    final Map<String, String> paragraphVariables = variables.getParagraphVariables();
    assertEquals(0, paragraphVariables.size());

    assertNull(variables.getFiguresDirectory());
  }
コード例 #2
0
  @Test
  public void testGetWordVariables() throws IOException {
    final String properties =
        "word.schnick=juchee\n" + "word.schnack=blablabla\n" + "something.else=weDoNotSeeThis";
    final ByteArrayInputStream inputStream = new ByteArrayInputStream(properties.getBytes());

    variables.load(inputStream);

    final Map<String, String> wordVariables = variables.getWordVariables();
    assertEquals(2, wordVariables.size());

    assertEquals("juchee", wordVariables.get("word.schnick"));
    assertEquals("blablabla", wordVariables.get("word.schnack"));
  }
コード例 #3
0
  @Test
  public void testLoad() throws IOException {
    final InputStream propertiesStream =
        TemplateVariablesTest.class.getResourceAsStream("pvir-template.properties");
    assertNotNull(propertiesStream);

    try {
      variables.load(propertiesStream);
      final Map<String, String> wordVariables = variables.getWordVariables();

      assertEquals(4, wordVariables.size());
    } finally {
      propertiesStream.close();
    }
  }
コード例 #4
0
  @Test
  public void testGetWordVariables_withDefaults() throws IOException {
    final String properties =
        "word.schnick=juchee\n"
            + "word.schnick.default=hurra\n"
            + "word.schnack.default=bla_default";
    final ByteArrayInputStream inputStream = new ByteArrayInputStream(properties.getBytes());

    variables.load(inputStream);

    final Map<String, String> wordVariables = variables.getWordVariables();
    assertEquals(2, wordVariables.size());

    assertEquals("juchee", wordVariables.get("word.schnick"));
    assertEquals("bla_default", wordVariables.get("word.schnack"));
  }