Esempio n. 1
0
  @Test
  public void conference() {
    try {
      Response response = new Response();
      response.conference = new Conference("ciao");
      response.conference.relayDTMF = true;
      StringWriter sw = new StringWriter();
      JAXBContext jaxbContext = JAXBContext.newInstance(Response.class);
      Marshaller jaxbMarshaller = jaxbContext.createMarshaller();

      // output pretty printed
      jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);

      jaxbMarshaller.marshal(response, sw);
      Assert.assertEquals(
          "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Conference relayDTMF=\"true\">ciao</Conference></Response>",
          sw.toString());
    } catch (Exception e) {
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }
  }