### Question:
NmeaUtil { public static String createNmeaLine(LinkedHashMap<String, String> tags, List<String> items) { StringBuilder s = new StringBuilder(40); s.append(createTagBlock(tags)); int startForChecksum = s.length(); boolean first = true; for (String item : items) { if (!first) s.append(","); s.append(item); first = false; } String checksum = NmeaUtil.getChecksum(s.substring(startForChecksum)); s.append("*"); s.append(checksum); return s.toString(); } private  NmeaUtil(); static boolean isValid(String sentence); static String getChecksum(String sentence); static String getChecksum(String sentence, boolean ignoreLeadingDollarOrExclamation); static NmeaMessage parseNmea(String line); static String insertKeyValueInTagBlock(String line, String name, String value); static String supplementWithTime(String line, long arrivalTime); static Talker getTalker(String s); static String createTagBlock(LinkedHashMap<String, String> tags); static String createNmeaLine(LinkedHashMap<String, String> tags, List<String> items);  }### Answer:
@Test public void testCanCreateNmeaLine() { String line = "!BSVDM,2,1,0,A,577V7s02?k61I8Lg<00Dq@E918U<F1=@58000016Op`BL5D8tIm5@PDPCp0T,0*5B"; List<String> list = createSampleList(); String result = NmeaUtil.createNmeaLine(null, list); assertEquals(line, result); }
@Test public void testCreationOfNmeaLineFromTagsAndMessage() { String tag = "\\g:1-2-1536,c:1334258609*2F\\"; String line = "!BSVDM,2,1,0,A,577V7s02?k61I8Lg<00Dq@E918U<F1=@58000016Op`BL5D8tIm5@PDPCp0T,0*5B"; List<String> list = createSampleList(); LinkedHashMap<String, String> tags = createSampleTags(); assertEquals(tag + line, NmeaUtil.createNmeaLine(tags, list)); }