MCPcopy Create free account
hub / github.com/apache/pig / checkExceptionMessage

Method checkExceptionMessage

test/org/apache/pig/test/Util.java:640–656  ·  view source on GitHub ↗

Check if query plan for alias argument produces exception with expected error message in expectedErr argument. @param query @param alias @param expectedErr @throws IOException

(String query, String alias, String expectedErr)

Source from the content-addressed store, hash-verified

638 * @throws IOException
639 */
640 static public void checkExceptionMessage(String query, String alias, String expectedErr)
641 throws IOException {
642 PigServer pig = new PigServer(ExecType.LOCAL);
643
644 boolean foundEx = false;
645 try{
646 Util.registerMultiLineQuery(pig, query);
647 pig.explain(alias, System.out);
648 }catch(FrontendException e){
649 foundEx = true;
650 checkMessageInException(e, expectedErr);
651 }
652
653 if(!foundEx)
654 fail("No exception thrown. Exception is expected.");
655
656 }
657
658 public static void checkMessageInException(FrontendException e,
659 String expectedErr) {

Calls 3

explainMethod · 0.95

Tested by

no test coverage detected