### Question:
Util { public static void checkMessageId(int messageId, AisMessageType... messageTypes) { boolean found = false; for (AisMessageType messageType : messageTypes) { if (messageType.getId() == messageId) found = true; } if (!found) { StringBuffer s = new StringBuffer(); for (AisMessageType messageType : messageTypes) { if (s.length() > 0) s.append(","); s.append(messageType.getId() + ""); } checkArgument(found, "messageId must be in [" + s + "] but was " + messageId); } } private  Util(); static void checkLatLong(double lat, double lon); static void checkLat(double lat); static void checkLong(double lon); static void checkArgument(boolean b, String message); static AisExtractorFactory getAisExtractorFactory(); static void checkMessageId(int messageId, AisMessageType... messageTypes); static boolean areEqual(int i, int j); static boolean isClassAPositionReport(int messageId);  }### Answer:
@Test(expected = AisParseException.class) public void testCheckMessageIdThrowsAisParseExceptionWhenMessageIdsNotEqual() { Util.checkMessageId(0, AisMessageType.POSITION_REPORT_ASSIGNED); }
@Test public void testCheckMessageId() { Util.checkMessageId(AisMessageType.POSITION_REPORT_ASSIGNED.getId(), AisMessageType.POSITION_REPORT_ASSIGNED); }
@Test(expected = AisParseException.class) public void testCheckMessageIdShouldThrowExceptionIfListEmpty() { Util.checkMessageId(AisMessageType.POSITION_REPORT_ASSIGNED.getId()); }
@Test public void testCheckMessageIdInMultiple() { Util.checkMessageId(AisMessageType.POSITION_REPORT_ASSIGNED.getId(), AisMessageType.POSITION_REPORT_ASSIGNED, AisMessageType.POSITION_REPORT_CLASS_B); }
@Test public void testCheckMessageIdInMultipleChangedOrder() { Util.checkMessageId(AisMessageType.POSITION_REPORT_ASSIGNED.getId(), AisMessageType.POSITION_REPORT_ASSIGNED, AisMessageType.POSITION_REPORT_CLASS_B); }
@Test(expected = AisParseException.class) public void testCheckMessageIdNotInMultiple() { Util.checkMessageId(AisMessageType.POSITION_REPORT_SPECIAL.getId(), AisMessageType.POSITION_REPORT_ASSIGNED, AisMessageType.POSITION_REPORT_CLASS_B); }