1111
1212import java .util .List ;
1313import org .antlr .v4 .runtime .tree .ParseTree ;
14+ import org .hamcrest .text .StringContainsInOrder ;
1415import org .junit .Rule ;
1516import org .junit .Test ;
1617import org .junit .rules .ExpectedException ;
@@ -340,6 +341,10 @@ public void testDescribeCommandWithSourceShouldFail() {
340341 exceptionRule .expectMessage (
341342 "[=] is not a valid term at this part of the query: 'describe source=' <-- HERE. Expecting"
342343 + " tokens: EOF, '|', ',', '.'" );
344+ exceptionRule .expectMessage (
345+ StringContainsInOrder .stringContainsInOrder (
346+ "[=] is not a valid term at this part of the query: 'describe source=' <-- HERE." ,
347+ "Expecting tokens:" ));
343348
344349 new PPLSyntaxParser ().parse ("describe source=t" );
345350 }
@@ -348,9 +353,12 @@ public void testDescribeCommandWithSourceShouldFail() {
348353 public void testInvalidOperatorCombinationShouldFail () {
349354 exceptionRule .expect (RuntimeException .class );
350355 exceptionRule .expectMessage (
351- "[<EOF>] is not a valid term at this part of the query: '...= t | where x > y OR' <-- HERE."
352- + " Expecting one of 294 possible tokens. Some examples: 'SEARCH', 'DESCRIBE', 'SHOW',"
353- + " 'FROM', 'WHERE', ..." );
356+ StringContainsInOrder .stringContainsInOrder (
357+ "[<EOF>] is not a valid term at this part of the query: '...= t | where x > y OR' <--"
358+ + " HERE." ,
359+ "Expecting one of " ,
360+ " possible tokens. Some examples: " ,
361+ "..." ));
354362
355363 new PPLSyntaxParser ().parse ("source = t | where x > y OR" );
356364 }
0 commit comments