Esempio n. 1
0
  @Test
  public void givenCloseTag_WhenParse_ThenNameOfTheTagEqualsNameOfTheInputTag() {
    String inputString = "<name></name>";

    handler =
        new Handler() {
          @Override
          public void handle(Element element) {
            myElement = element;
          }
        };
    builder.onCloseTag(handler);
    parser = builder.build();
    parser.parse(inputString);

    assertEquals("name", myElement.getName());
  }
Esempio n. 2
0
  @Test
  public void givenCloseTag_WhenHandleSetsTypeOfTag_ThenTypeOfTheTagEqualsCLOSE() {

    String inputString = "<name></name>";

    handler =
        new Handler() {
          @Override
          public void handle(Element element) {
            myElement = element;
          }
        };
    builder.onCloseTag(handler);
    parser = builder.build();
    parser.parse(inputString);
    TagElementType actual = myElement.getType();
    TagElementType expected = TagElementType.CLOSE;

    assertEquals(expected, actual);
  }