* Description: Encode body types test<br>
* Expectation: passes
*/
@Test
public void t13_EncodeBodyTypesTest() {
IEncoderDecoder coder = coderFactory.createEncoderDecoder(encodeScmp);
String header = "msn=" + msgSequenceNr + "\n" + "bty=" + bodyType.getValue() + "\n" + "mty=" + msgType.getValue() + "\n";
String expectedString = TestUtil.getSCMPString(headKey, header, body);
OutputStream os = new ByteArrayOutputStream();
try {
coder.encode(os, encodeScmp);
} catch (Exception e) {
Assert.fail("Should not throw exception");
}
Assert.assertEquals(expectedString, os.toString());
coder = coderFactory.createEncoderDecoder(encodeScmp);
bodyType = SCMPBodyType.TEXT;
encodeScmp.setHeader(SCMPHeaderAttributeKey.BODY_TYPE, bodyType.getValue());
header = "msn=" + msgSequenceNr + "\n" + "bty=" + bodyType.getValue() + "\n" + "mty=" + msgType.getValue() + "\n";
expectedString = TestUtil.getSCMPString(headKey, header, body);
os = new ByteArrayOutputStream();
try {
coder.encode(os, encodeScmp);
} catch (Exception e) {
Assert.fail("Should not throw exception");
}
Assert.assertEquals(expectedString, os.toString());
}