public void testFromString5() { final String messageStr = "msgId1 [data1 a=b\"] my message!!"; try { StructuredSyslogMessage.fromString(messageStr); fail(); } catch (IllegalArgumentException iae) { // } }
public void testFromString6() { final String messageStr = "msgId1 [data1 a=\"b\"] my message!!"; final StructuredSyslogMessage message = StructuredSyslogMessage.fromString(messageStr); assertEquals("my message!!", message.getMessage()); assertEquals("msgId1", message.getMessageId()); assertTrue(message.getStructuredData().size() == 1); assertTrue(((Map) message.getStructuredData().get("data1")).size() == 1); assertEquals("b", ((Map) message.getStructuredData().get("data1")).get("a")); }
public void testFromString1() { final String messageStr = "msgId1 [0@0] my message!!"; final StructuredSyslogMessage message = StructuredSyslogMessage.fromString(messageStr); assertEquals("msgId1 [0@0] my message!!", message.toString()); assertEquals(-108931075, message.hashCode()); assertEquals("my message!!", message.getMessage()); assertEquals("msgId1", message.getMessageId()); assertTrue(message.getStructuredData().size() == 0); }
public void testCreateMessage4() { final Map map = new HashMap(); final StructuredSyslogMessage message = new StructuredSyslogMessage("msgId", map, "my message"); assertEquals("msgId [0@0] my message", message.createMessage()); }
public void testCreateMessage2() { final StructuredSyslogMessage message = new StructuredSyslogMessage("msgId", null, "my message"); assertEquals("msgId [0@0] my message", message.createMessage()); }