Example #1
0
  @Test
  public void should_create_admin_terminer() {
    Admin adminDoc = new Admin(Admin.ADMIN_TERMINER);

    assertThat(adminDoc.getType().getValue()).isEqualTo(TM_ADMIN);
    assertThat(adminDoc.getTypeRequete()).isEqualTo(ADMIN_TERMINER);
  }
Example #2
0
  @Test
  public void should_create_admin_terminer_by_xml() {
    StringBuilder xmlBuilder = new StringBuilder();
    xmlBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    xmlBuilder.append("<!DOCTYPE MSG SYSTEM \"src/main/resources/MSG.dtd\">\n");
    xmlBuilder.append("<MSG>\n");
    xmlBuilder.append("<ADMIN REQUETE=\"terminer\"/>\n");
    xmlBuilder.append("</MSG>\n");
    Protocole newInstance = Admin.newInstance(xmlBuilder.toString());

    assertThat(newInstance).isNotNull();
    assertThat(newInstance).isInstanceOf(Admin.class);
    assertThat(newInstance.getType().getValue()).isEqualTo(TM_ADMIN);
    Admin instance = (Admin) newInstance;
    assertThat(instance.getTypeRequete()).isEqualTo(ADMIN_TERMINER);
    assertThat(instance.toXML())
        .isEqualTo(xmlBuilder.toString().replace("src/main/resources/MSG.dtd", "MSG.dtd"));
  }