### Question:
TaskHelper { public static <CFG extends AbstractConfig> void logRecordContent(Logger logger, ConnectRecord<?> record, CFG config) { if (logger != null && record != null && config != null) { LoggingLevel level = LoggingLevel.OFF; try { final String key = (record instanceof SourceRecord) ? CamelSourceConnectorConfig.CAMEL_SOURCE_CONTENT_LOG_LEVEL_CONF : CamelSinkConnectorConfig.CAMEL_SINK_CONTENT_LOG_LEVEL_CONF; level = LoggingLevel.valueOf(config.getString(key).toUpperCase()); } catch (Exception e) { logger.warn("Invalid value for contentLogLevel property"); } switch (level) { case TRACE: logger.trace(record.toString()); break; case DEBUG: logger.debug(record.toString()); break; case INFO: logger.info(record.toString()); break; case WARN: logger.warn(record.toString()); break; case ERROR: logger.error(record.toString()); break; default: break; } } } private  TaskHelper(); static String buildUrl(RuntimeCamelCatalog rcc, Map<String, String> props, String componentSchema, String endpointPropertiesPrefix, String pathPropertiesPrefix); static String buildUrl(Map<String, String> props, String componentSchema, String endpointPropertiesPrefix, String pathPropertiesPrefix); static String createEndpointOptionsFromProperties(Map<String, String> props, String prefix); static String createUrlPathFromProperties(Map<String, String> props, String prefix); static Map<String, String> mergeProperties(Map<String, String> defaultProps, Map<String, String> loadedProps); static void logRecordContent(Logger logger, ConnectRecord<?> record, CFG config);  }### Answer:
@Test public void testlogRecordContent() { String partName = "abc123"; Logger logger = new MyLogger(LoggerFactory.getLogger(TaskHelperTest.class), null); SourceRecord record = new SourceRecord(Collections.singletonMap("partition", partName), Collections.singletonMap("offset", "0"), null, null, null, null); Queue<String> logEvents = ((MyLogger)logger).getEvents(); String offLevel = LoggingLevel.OFF.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(offLevel)); assertNull(logEvents.poll()); String traceLevel = LoggingLevel.TRACE.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(traceLevel)); assertTrue(logEvents.peek().contains(traceLevel) && logEvents.poll().contains(partName)); String debugLevel = LoggingLevel.DEBUG.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(debugLevel)); assertTrue(logEvents.peek().contains(debugLevel) && logEvents.poll().contains(partName)); String infoLevel = LoggingLevel.INFO.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(infoLevel)); assertTrue(logEvents.peek().contains(infoLevel) && logEvents.poll().contains(partName)); String warnLevel = LoggingLevel.WARN.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(warnLevel)); assertTrue(logEvents.peek().contains(warnLevel) && logEvents.poll().contains(partName)); String errorLevel = LoggingLevel.ERROR.toString(); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(errorLevel)); assertTrue(logEvents.peek().contains(errorLevel) && logEvents.poll().contains(partName)); TaskHelper.logRecordContent(null, record, getSourceConnectorConfig(debugLevel)); assertNull(logEvents.poll()); TaskHelper.logRecordContent(logger, null, getSourceConnectorConfig(debugLevel)); assertNull(logEvents.poll()); TaskHelper.logRecordContent(logger, record, null); assertNull(logEvents.poll()); String invalidLevel = "NOLOG"; TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(invalidLevel)); assertTrue(logEvents.poll().contains(warnLevel)); TaskHelper.logRecordContent(logger, record, getSourceConnectorConfig(null)); assertTrue(logEvents.poll().contains(warnLevel)); }