[
https://issues.apache.org/jira/browse/METRON-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16470538#comment-16470538
]
ASF GitHub Bot commented on METRON-1549:
----------------------------------------
Github user mmiklavc commented on a diff in the pull request:
https://github.com/apache/metron/pull/1009#discussion_r187363182
--- Diff:
metron-platform/metron-parsers/src/test/java/org/apache/metron/writers/integration/WriterBoltIntegrationTest.java
---
@@ -166,6 +185,139 @@ public void test() throws UnableToStartException,
IOException, ParseException {
}
}
+ /**
+ * {
+ *
"parserClassName":"org.apache.metron.writers.integration.WriterBoltIntegrationTest$EmptyObjectParser",
+ * "sensorTopic":"emptyobjectparser",
+ * "outputTopic": "enrichments",
+ * "errorTopic": "parser_error"
+ * }
+ */
+ @Multiline
+ public static String offsetParserConfigJSON;
+
+ @Test
+ public void commits_kafka_offsets_for_emtpy_objects() throws Exception {
--- End diff --
My thoughts here probably belong in a discuss thread, but the example
serves well in the moment. Just for disclosure, I almost always format my code
using the IDE formatting tool that Justin shared some time ago with checkstyle.
I'm inclined to want to break convention when the outcome can be of greater
benefit than adhering strictly to the rules. The underscore pattern happens to
be a test method naming convention that a group of 30 engineers and myself
landed on 7 years ago while re-writing a million+ line application that had no
tests from the ground up to include unit, integration, and acceptance tests.
After a lot of trial and error, it was the most clear for everyone involved.
Which do you prefer to read? Which reads most naturally? Which provides
context about the test without needing extraneous javadoc?
```
commits_kafka_offsets_for_emtpy_objects()
CommitsKafkaOffsetsForEmtpyObjects()
testCommits()
test()
```
**TL;DR**
Per the Google style guide, this naming convention is allowable:
> Underscores may appear in JUnit test method names to separate logical
components of the name, with each component written in lowerCamelCase. One
typical pattern is <methodUnderTest>_<state>, for example pop_emptyStack.
**There is no One Correct Way to name test methods.**
https://google.github.io/styleguide/javaguide.html#s5.2-specific-identifier-names
https://stackoverflow.com/questions/96297/what-are-some-popular-naming-conventions-for-unit-tests
https://dzone.com/articles/7-popular-unit-test-naming
> Add empty object test to WriterBoltIntegrationTest implementation
> -----------------------------------------------------------------
>
> Key: METRON-1549
> URL: https://issues.apache.org/jira/browse/METRON-1549
> Project: Metron
> Issue Type: Test
> Reporter: Michael Miklavcic
> Assignee: Michael Miklavcic
> Priority: Major
>
> Verify expected output when empty objects returned by custom parsers.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)