Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi/pull/563#discussion_r69828743 --- Diff: nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/test/java/org/apache/nifi/processors/kafka/TestGetKafka.java --- @@ -166,4 +170,44 @@ public MessageAndMetadata answer(InvocationOnMock invocation) throws Throwable { } } + @Test + public void testGetState() throws Exception { + final GetKafka processor = new GetKafka(); + final TestRunner runner = TestRunners.newTestRunner(processor); + + assertNull("State should be null when required properties are not specified.", processor.getState()); + + runner.setProperty(GetKafka.ZOOKEEPER_CONNECTION_STRING, "0.0.0.0:invalid-port"); + runner.setProperty(GetKafka.TOPIC, "testX"); + + assertNull("State should be null when required properties are not specified.", processor.getState()); + + runner.setProperty(GetKafka.GROUP_ID, "consumer-group-id"); + + try { + processor.getState(); + fail("The processor should try to access Zookeeper and should fail since it can not connect."); + } catch (IOException e) { + } + } + + @Test + public void testClearState() throws Exception { + final GetKafka processor = new GetKafka(); + final TestRunner runner = TestRunners.newTestRunner(processor); + + // Clear doesn't do anything until required properties are set. + processor.clear(); + + runner.setProperty(GetKafka.ZOOKEEPER_CONNECTION_STRING, "0.0.0.0:invalid-port"); + runner.setProperty(GetKafka.TOPIC, "testX"); + runner.setProperty(GetKafka.GROUP_ID, "consumer-group-id"); + + try { + processor.getState(); --- End diff -- This is a unit test to clearState but calls getState here.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---