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

Method testError

test/org/apache/pig/TestStoreFuncWrapper.java:85–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84 // Asserts that each call to an improperly initialized Wrapper fails.
85 @Test
86 public void testError() throws IOException {
87 MockWrapper wrapper = new MockWrapper(); // <-- !! storeFunc not set !!
88
89 IllegalArgumentException e = null;
90 try {
91 wrapper.getOutputFormat();
92 } catch (IllegalArgumentException ex) {
93 e = ex;
94 }
95
96 assertNotNull("A useful exception should have been thrown when a method is called on an "
97 + "improperly initialized StoreFuncWrapper", e);
98 assertTrue("The method name that caused the problem should have been mentioned in the "
99 + "exception, since the stack trace gets swallowed when this occurs",
100 e.getMessage().contains("getOutputFormat"));
101 }
102
103 private static class MockWrapper extends StoreFuncWrapper {
104 private MockWrapper() { }

Callers

nothing calls this directly

Calls 3

getOutputFormatMethod · 0.65
containsMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected