### Question:
LogUtil { public static String addCustomAnnotations(@Nullable String logLine, @Nullable PhoenixConnection con) { if (con == null || con.getCustomTracingAnnotations() == null || con.getCustomTracingAnnotations().isEmpty()) { return logLine; } else { return customAnnotationsToString(con) + ' ' + logLine; } } private  LogUtil(); static String addCustomAnnotations(@Nullable String logLine, @Nullable PhoenixConnection con); static String addCustomAnnotations(@Nullable String logLine, @Nullable byte[] annotations); static String customAnnotationsToString(@Nullable PhoenixConnection con); static String getCallerStackTrace();  }### Answer:
@Test public void testAddCustomAnnotationsWithNullConnection() { String logLine = LogUtil.addCustomAnnotations("log line", (PhoenixConnection)null); assertEquals(logLine, "log line"); }
@Test public void testAddCustomAnnotationsWithNullAnnotations() { when(con.getCustomTracingAnnotations()).thenReturn(null); String logLine = LogUtil.addCustomAnnotations("log line", con); assertEquals(logLine, "log line"); }
@Test public void testAddCustomAnnotations() { when(con.getCustomTracingAnnotations()).thenReturn(ImmutableMap.of("a1", "v1", "a2", "v2")); String logLine = LogUtil.addCustomAnnotations("log line", con); assertTrue(logLine.contains("log line")); assertTrue(logLine.contains("a1=v1")); assertTrue(logLine.contains("a2=v2")); }