@Test
public void parseSubmitBadDestinationAddressValue() throws Exception {

    StringBuilder string0 = new StringBuilder(200)
        .append("<?xml version=\"1.0\"?>\n")
        .append("<operation type=\"submit\">\n")
        .append(" <account username=\"customer1\" password=\"test1\"/>\n")
        .append(" <submitRequest referenceId=\"MYREF102020022\">\n")
        .append("  <operatorId>1</operatorId>\n")
        .append("  <deliveryReport>TrUe</deliveryReport>\n")
        .append("  <sourceAddress type=\"network\">40404</sourceAddress>\n")
        .append("  <destinationAddress type=\"international\">12065551212</destinationAddress>\n")
        .append("  <text encoding=\"ISO-8859-1\">48656c6c6f20576f726c64</text>\n")
        .append(" </submitRequest>\n")
        .append("</operation>\n")
        .append("");
    ByteArrayInputStream is = new ByteArrayInputStream(string0.toString().getBytes());
    SxmpParser parser = new SxmpParser();
    try {
        Operation operation = parser.parse(is);
        Assert.fail();
    } catch (SxmpParsingException e) {
         // correct behavior
        Assert.assertEquals(SxmpErrorCode.UNABLE_TO_CONVERT_VALUE, e.getErrorCode());
        Assert.assertThat(e.getMessage(), CoreMatchers.containsString("International address must start with"));
        Assert.assertNotNull(e.getOperation());
        SubmitRequest submitRequest = (SubmitRequest)e.getOperation();
        Assert.assertEquals(Operation.Type.SUBMIT, submitRequest.getType());
        // we should have partially parsed the submit request
        Assert.assertEquals(new Integer(1), submitRequest.getOperatorId());
        Assert.assertEquals(Boolean.TRUE, submitRequest.getDeliveryReport());
        Assert.assertEquals(MobileAddress.Type.NETWORK, submitRequest.getSourceAddress().getType());
        Assert.assertEquals("40404", submitRequest.getSourceAddress().getAddress());
    }
}