+
+ /**
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * - not existing code used
+ */
+ @Test
+ public void testWithoutData2() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 00 FF FF");
+ ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 0, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "HELLOFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 01 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 1, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "BADREQUEST", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 02 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 2, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "BADACTION", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 03 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 04 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 4, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "BADMATCH", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 05 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 5, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "FLOWMODFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 06 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 6, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "GROUPMODFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 07 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 7, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "PORTMODFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 08 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 8, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "TABLEMODFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 09 FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 9, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "QUEUEOPFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 0A FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 10, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "SWITCHCONFIGFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 0B FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 11, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "ROLEREQUESTFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 0C FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 12, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "METERMODFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+
+ bb = BufferHelper.buildBuffer("00 0D FF FF");
+ builtByFactory = BufferHelper.deserialize(errorFactory, bb);
+
+ BufferHelper.checkHeaderV13(builtByFactory);
+ Assert.assertEquals("Wrong type", 13, builtByFactory.getType().intValue());
+ Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
+ Assert.assertEquals("Wrong type string", "TABLEFEATURESFAILED", builtByFactory.getTypeString());
+ Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
+ Assert.assertNull("Data is not null", builtByFactory.getData());
+ }
+