### Question:
LogicalNode implements Reportable { public boolean checkConfig(FlumeConfigData data) { if (data == null) { return false; } if (data.getSourceVersion() <= lastGoodCfg.getSourceVersion()) { if (data.getSourceVersion() < lastGoodCfg.getSourceVersion()) { LOG.warn("reject because config older than the current. "); return false; } LOG.debug("do nothing: retrieved config (" + new Date(data.getSourceVersion()) + ") same as current (" + new Date(lastGoodCfg.getSourceVersion()) + "). "); return false; } try { loadConfig(data); } catch (Exception e) { LOG.warn("Configuration " + data + " failed to load!", e); return false; } return true; } LogicalNode(Context ctx, String name); void loadConfig(FlumeConfigData cfg); boolean checkConfig(FlumeConfigData data); void getReports(Map<String, ReportEvent> reports); ReportEvent getReport(); String getName(); long getConfigVersion(); NodeStatus getStatus(); void close(); EventSink getSink(); EventSource getSource(); static final long VERSION_INFIMUM; static final String A_RECONFIGURES; }### Answer:
@Test public void testCheckConfig() { LogicalNode node = new LogicalNode(new Context(), "test-logical-node"); assertFalse(node.checkConfig(null)); FlumeConfigData cfgData = new FlumeConfigData(0, "null", "null", 0, 0, "my-test-flow"); assertTrue(node.checkConfig(cfgData)); assertFalse(node.checkConfig(cfgData)); FlumeConfigData cfgData2 = new FlumeConfigData(0, "null", "null", 1, 0, "my-test-flow"); assertTrue(node.checkConfig(cfgData2)); assertFalse(node.checkConfig(cfgData2)); assertFalse(node.checkConfig(cfgData)); FlumeConfigData cfgData3 = new FlumeConfigData(0, "null", "null", 1, 1, "my-test-flow"); assertFalse(node.checkConfig(cfgData)); assertFalse(node.checkConfig(cfgData2)); assertFalse(node.checkConfig(cfgData3)); }