Example usage for junit.framework AssertionFailedError getMessage

List of usage examples for junit.framework AssertionFailedError getMessage

Introduction

In this page you can find the example usage for junit.framework AssertionFailedError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQuery22Fail() {
    buildPlan("A = load 'a' as (a:int, b: double);");
    try {/*w w  w  .  j ava2  s .c o  m*/
        buildPlan("B = group A by (*, $0);");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Grouping attributes can either be star (*"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQuery23Fail() {
    buildPlan("A = load 'a' as (a: int, b:double);");
    buildPlan("B = load 'b';");
    boolean exceptionThrown = false;
    try {//w w  w.  j a va  2 s  . c  o  m
        buildPlan("C = cogroup A by (*, $0), B by ($0, $1);");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("The arity of cogroup/group by columns " + "do not match"));
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQuery23Fail2() {
    buildPlan("A = load 'a';");
    buildPlan("B = load 'b';");
    boolean exceptionThrown = false;
    try {/*from  ww  w . ja  v  a 2  s . c  o m*/
        buildPlan("C = cogroup A by (*, $0), B by ($0, $1);");
    } catch (AssertionFailedError e) {
        assertTrue(
                e.getMessage().contains("Cogroup/Group by * is only allowed if " + "the input has a schema"));
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQuery23Fail3() {
    buildPlan("A = load 'a' as (a: int, b:double);");
    buildPlan("B = load 'b' as (a:int);");
    boolean exceptionThrown = false;
    try {/*from  ww  w .  j  a  v  a  2s. c  om*/
        buildPlan("C = cogroup A by *, B by *;");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("The arity of cogroup/group by columns " + "do not match"));
        exceptionThrown = true;
    }
    assertTrue(exceptionThrown);
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail37() {
    String query = "A = load 'a'; asdasdas";
    try {//from   w w  w . j a  v  a2 s. c o m
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail39() {
    buildPlan("a = load 'a' as (url, host, rank);");
    buildPlan("b = group a by (url,host); ");
    LogicalPlan lp = buildPlan("c = foreach b generate flatten(group.url), SUM(a.rank) as totalRank;");
    buildPlan("d = filter c by totalRank > '10';");
    try {//  w w  w .  j av a 2s. c  o  m
        buildPlan("e = foreach d generate url;");//url has been falttened and hence the failure
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail41() {
    buildPlan("a = load 'a';");
    try {//from  w  ww.j  a  v  a 2 s.  c om
        buildPlan("b = a as (host,url);");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Currently PIG does not support assigning an existing relation"));
    }
    // TODO
    // the following statement was earlier present
    // eventually when we do allow assignments of the form
    // above, we should test with the line below
    // uncommented
    //buildPlan("foreach b generate host;");
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail43() {
    buildPlan("a = load 'a' as (name, age, gpa);");
    buildPlan("b = load 'b' as (name, height);");
    try {//from w w  w .  j  a v  a2  s. c o  m
        String query = "c = cogroup a by (name, age), b by (height);";
        buildPlan(query);
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail58() {
    buildPlan("a = load 'a' as (url, host, rank);");
    buildPlan("b = group a by url; ");
    try {//from  ww  w.  j  a  v a 2s  .  c o m
        LogicalPlan lp = buildPlan("c = foreach b generate group.url;");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}

From source file:org.apache.pig.test.TestLogicalPlanBuilder.java

@Test
public void testQueryFail62() {
    buildPlan("a = load 'a' as (name, age, gpa);");
    buildPlan("b = load 'b' as (name, height);");
    String query = "c = cross a,b;";
    buildPlan(query);//from   ww w  .j av  a 2 s  .  c om
    try {
        buildPlan("d = order c by name, b::name, height, a::gpa;");
    } catch (AssertionFailedError e) {
        assertTrue(e.getMessage().contains("Exception"));
    }
}