Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/232#discussion_r76413858
  
    --- Diff: 
metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/bro/BasicBroParserTest.java
 ---
    @@ -46,14 +46,37 @@ public BasicBroParserTest() throws Exception {
                jsonParser = new JSONParser();
        }
     
    -    public void testUnwrappedBroMessage() throws ParseException {
    -        String rawMessage = 
"{\"timestamp\":\"1449511228474\",\"uid\":\"CFgSLp4HgsGqXnNjZi\",\"source_ip\":\"104.130.172.191\",\"source_port\":33893,\"dest_ip\":\"69.20.0.164\",\"dest_port\":53,\"proto\":\"udp\",\"trans_id\":3514,\"rcode\":3,\"rcode_name\":\"NXDOMAIN\",\"AA\":false,\"TC\":false,\"RD\":false,\"RA\":false,\"Z\":0,\"rejected\":false,\"sensor\":\"cloudbro\",\"type\":\"dns\"}";
    +   /**
    +    * This test is included as a gut-check about our formatting 
expectations using the Java JDK
    +    * 
https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
    +    */
    +   public void testDecimalFormatAssumptions() {
    +           Pair[] pairs = {
    +                                           Pair.of(new Double(12345678), 
"12345678.0"),
    +                                           Pair.of(new Double(12345678.0), 
"12345678.0"),
    +                                           Pair.of(new Double(12345678.1), 
"12345678.1"),
    +                                           Pair.of(new 
Double(12345678.11), "12345678.11"),
    +                                           Pair.of(new 
Double(12345678.111), "12345678.111"),
    +                                           Pair.of(new 
Double(12345678.1111), "12345678.1111"),
    +                                           Pair.of(new 
Double(12345678.11111), "12345678.11111"),
    +                                           Pair.of(new 
Double(12345678.111111), "12345678.111111")
    +           };
    +           for (Pair pair : pairs) {
    +                   assertEquals("Format did not match", pair.getRight(), 
new DecimalFormat("0.0#####").format(pair.getLeft()));
    --- End diff --
    
    Can we refer to BasicBroParser.DECIMAL_FORMAT rather than explicitly 
creating the decimal format.  This way if the decimal format changes, we're 
aware of it in the unit test and the gut-check you just did can be redone for 
the new implementer.


---
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.
---

Reply via email to