MessageUtils { public static String serializeMsgid(String msgctx, String msgid) { if (msgid == null) { throw new IllegalArgumentException("msgid must not be null"); } if (msgctx == null) { return msgid; } else { return msgctx + "\u0004" + msgid; } }  static String getPluralForms(Message header); static String serializeMsgid(String msgctx, String msgid); static String serializeMsgid(Message msg); static String serializeMsgstr(Message message); static byte[] serializeMsgstrUTF8(Message message); static byte[] serializeMsgidUTF8(Message message);  }
@Test public void testNoContext() { Assert.assertEquals("id", MessageUtils.serializeMsgid(null, "id")); }
@Test public void testContext() { Assert.assertEquals("ctx\u0004id", MessageUtils.serializeMsgid("ctx", "id")); }
@Test public void testContextAndPlural() { Message msg = new Message(); msg.setMsgctxt("ctx"); msg.setMsgid("id"); msg.setMsgidPlural("ids"); Assert.assertEquals("ctx\u0004id\u0000ids", MessageUtils.serializeMsgid(msg)); }