11package io .krakens .grok .api ;
22
3+ import java .util .HashSet ;
34import java .util .Map ;
45
56import org .assertj .core .api .Assertions ;
67import org .junit .Test ;
8+ import static org .hamcrest .Matchers .containsInAnyOrder ;
9+ import static org .hamcrest .Matchers .hasItem ;
10+ import static org .junit .Assert .*;
11+
12+ import org .assertj .core .util .Arrays ;
713
814public class GrokDocumentationTest {
915
@@ -27,5 +33,23 @@ public void assureCodeInReadmeWorks() {
2733 final Map <String , Object > capture = gm .capture ();
2834
2935 Assertions .assertThat (capture ).hasSize (22 );
36+ final boolean debug = false ;
37+ final Object [] keywordArray = new Object [] { "COMBINEDAPACHELOG" ,
38+ "COMMONAPACHELOG" , "clientip" , "ident" , "auth" , "timestamp" , "MONTHDAY" ,
39+ "MONTH" , "YEAR" , "TIME" , "HOUR" , "MINUTE" , "SECOND" , "INT" , "verb" ,
40+ "httpversion" , "rawrequest" , "request" , "response" , "bytes" , "referrer" ,
41+ "agent" };
42+ if (debug )
43+ capture .keySet ().stream ().forEach (System .err ::println );
44+ assertTrue (new HashSet <Object >(Arrays .asList (keywordArray ))
45+ .containsAll (new HashSet <Object >(capture .keySet ())));
46+
47+ Arrays .asList (keywordArray ).stream ()
48+ .forEach (o -> assertThat (capture .keySet (), hasItem ((String ) o )));
49+ assertThat (new HashSet <Object >(capture .keySet ()),
50+ containsInAnyOrder (keywordArray ));
51+ assertTrue (new HashSet <Object >(capture .keySet ())
52+ .containsAll (new HashSet <Object >(Arrays .asList (keywordArray ))));
53+
3054 }
3155}
0 commit comments