@Test public void writeSubmitRequestWithUTF8PushDestination() throws Exception { SubmitRequest request = new SubmitRequest(SxmpParser.VERSION_1_1); request.setAccount(new Account("customer1", "test1")); request.setOperatorId(20); request.setDestinationAddress(new MobileAddress(MobileAddress.Type.PUSH_DESTINATION, "abcd\n1234\rfghi-€£æ_\u20AC\u0623\u0647\u0644")); request.setText("Hello World"); StringWriter sw = new StringWriter(); SxmpWriter.write(sw, request); logger.debug("UTF8 PUSH DEST: "+sw.toString()); StringBuilder expectedXML = new StringBuilder(200) .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<operation type=\"submit\">\n") .append(" <account username=\"customer1\" password=\"test1\"/>\n") .append(" <submitRequest>\n") .append(" <operatorId>20</operatorId>\n") .append(" <priority>0</priority>\n") .append(" <deliveryReport>false</deliveryReport>\n") .append(" <destinationAddress type=\"push_destination\">abcd\n1234\rfghi-€£æ_\u20AC\u0623\u0647\u0644</destinationAddress>\n") .append(" <text encoding=\"UTF-8\">48656C6C6F20576F726C64</text>\n") .append(" </submitRequest>\n") .append("</operation>\n") .append(""); XMLUnit.setIgnoreWhitespace(true); Diff myDiff = new Diff(expectedXML.toString(), sw.toString()); DetailedDiff myDetailedDiff = new DetailedDiff(myDiff); Assert.assertTrue("XML are similar " + myDetailedDiff, myDetailedDiff.similar()); Assert.assertTrue(!expectedXML.toString().contains("optionalParams")); }
static public void write(Writer out, Operation operation) throws SxmpErrorException, IOException { write(out, operation, true); }
SxmpWriter { static public void write(Writer out, Operation operation) throws SxmpErrorException, IOException { write(out, operation, true); } }
SxmpWriter { static public void write(Writer out, Operation operation) throws SxmpErrorException, IOException { write(out, operation, true); }  }
SxmpWriter { static public void write(Writer out, Operation operation) throws SxmpErrorException, IOException { write(out, operation, true); }  static String createString(Operation operation); static void write(Writer out, Operation operation); static void write(Writer out, Operation operation, boolean withXmlHeader); }
SxmpWriter { static public void write(Writer out, Operation operation) throws SxmpErrorException, IOException { write(out, operation, true); }  static String createString(Operation operation); static void write(Writer out, Operation operation); static void write(Writer out, Operation operation, boolean withXmlHeader);  }