Пример #1
0
  @Test
  public void testEmptyConstruction() {

    // PREPARE & TEST
    final StringVariableResolver testee = new StringVariableResolver(new ArrayList<Variable>());

    // VERIFY
    assertThat(testee.getDepth()).isEmpty();
    assertThat(testee.getResolved()).isEmpty();
    assertThat(testee.getUnresolved()).isEmpty();
  }
Пример #2
0
  @Test
  public void testTwoLevels() {

    // PREPARE
    final List<Variable> vars = new ArrayList<Variable>();
    vars.add(new SimpleVariable("a", "a${b}"));
    vars.add(new SimpleVariable("b", "2"));

    // TEST
    final StringVariableResolver testee = new StringVariableResolver(vars);

    // VERIFY
    assertThat(testee.getDepth()).contains(entry("a", 1), entry("b", 0));
    assertThat(testee.getResolved()).contains(entry("a", "a2"), entry("b", "2"));
    assertThat(testee.getUnresolved()).contains(entry("a", "a${b}"), entry("b", "2"));
  }
Пример #3
0
  @Test
  public void testFourLevels() {

    // PREPARE
    final List<Variable> vars = new ArrayList<Variable>();
    vars.add(new SimpleVariable("a", "1${b}"));
    vars.add(new SimpleVariable("b", "2${c}"));
    vars.add(new SimpleVariable("c", "3${d}"));
    vars.add(new SimpleVariable("d", "4"));

    // TEST
    final StringVariableResolver testee = new StringVariableResolver(vars);

    // VERIFY
    assertThat(testee.getDepth())
        .contains(entry("a", 3), entry("b", 2), entry("c", 1), entry("d", 0));
    assertThat(testee.getResolved())
        .contains(entry("a", "1234"), entry("b", "234"), entry("c", "34"), entry("d", "4"));
    assertThat(testee.getUnresolved())
        .contains(entry("a", "1${b}"), entry("b", "2${c}"), entry("c", "3${d}"), entry("d", "4"));
  }