exceptionfactory commented on code in PR #5896: URL: https://github.com/apache/nifi/pull/5896#discussion_r842083436
########## nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLReader.java: ########## @@ -31,80 +33,99 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import static junit.framework.TestCase.assertEquals; public class TestXMLReader { - private XMLReader reader; - private final String ATTRIBUTE_PREFIX = "attribute_prefix"; private final String CONTENT_NAME = "content_field"; private final String EVALUATE_IS_ARRAY = "xml.stream.is.array"; - public TestRunner setup(String filePath) throws InitializationException, IOException { - + private TestRunner setup(Map<PropertyDescriptor, String> xmlReaderProperties) throws InitializationException { TestRunner runner = TestRunners.newTestRunner(TestXMLReaderProcessor.class); - reader = new XMLReader(); + XMLReader reader = new XMLReader(); + runner.addControllerService("xml_reader", reader); runner.setProperty(TestXMLReaderProcessor.XML_READER, "xml_reader"); - final String outputSchemaText = new String(Files.readAllBytes(Paths.get(filePath))); - runner.setProperty(reader, SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY, SchemaAccessUtils.SCHEMA_TEXT_PROPERTY); - runner.setProperty(reader, SchemaAccessUtils.SCHEMA_TEXT, outputSchemaText); + for (Map.Entry<PropertyDescriptor, String> entry : xmlReaderProperties.entrySet()) { + runner.setProperty(reader, entry.getKey(), entry.getValue()); + } + runner.enableControllerService(reader); return runner; } @Test - public void testRecordFormat() throws IOException, InitializationException { - TestRunner runner = setup("src/test/resources/xml/testschema"); - - runner.setProperty(reader, XMLReader.RECORD_FORMAT, XMLReader.RECORD_EVALUATE); - - runner.enableControllerService(reader); - + public void testRecordFormatDeterminedBasedOnAttribute() throws IOException, InitializationException { + // GIVEN Review Comment: I agree with the feedback from @markap14. The structure makes sense, but the simple `GIVEN`/`WHEN`/`THEN` comments do not add sufficient value to warrant inclusion as part of standard coding conventions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org