ctubbsii commented on code in PR #53:
URL: https://github.com/apache/accumulo-access/pull/53#discussion_r1489824023


##########
src/test/java/org/apache/accumulo/access/AccessExpressionTest.java:
##########
@@ -189,4 +198,30 @@ public void testEqualsHashcode() {
     assertEquals(ae1.hashCode(), ae3.hashCode());
     assertNotEquals(ae1.hashCode(), ae2.hashCode());
   }
+
+  @Test
+  public void testSpecificationDocumentation() throws IOException, 
URISyntaxException {
+    // verify AccessExpression.abnf matches what is documented in 
SPECIFICATION.md
+
+    // read the abnf spec, ignoring the header
+    List<String> specLinesFromAbnfFile;
+    try (
+        var abnfFileStream =
+            
AccessExpression.class.getResourceAsStream("specification/AccessExpression.abnf");
+        var inputStreamReader = new InputStreamReader(abnfFileStream, UTF_8);
+        var bufferedReader = new BufferedReader(inputStreamReader)) {
+
+      Predicate<String> abnfComment = line -> line.startsWith(";");
+      Predicate<String> beforeFirstLine = abnfComment.or(String::isBlank);
+      specLinesFromAbnfFile = 
bufferedReader.lines().dropWhile(beforeFirstLine).collect(toList());
+    }
+
+    // grab from the markdown, but make sure to skip the markdown triple ticks

Review Comment:
   I thought it would be useful to leave it in its own file in 
src/main/resources, so it could be grabbed from the jar by other projects, if 
they wanted to use it. As the canonical definition, I think it's useful in the 
jar so it can be used as a dependency.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to