use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class JobResultTest method testIsNotSuccess.
@Test
public void testIsNotSuccess() throws Exception {
final JobResult jobResult = new JobResult.Builder().jobId(new JobID()).serializedThrowable(new SerializedThrowable(new RuntimeException())).netRuntime(Long.MAX_VALUE).build();
assertThat(jobResult.isSuccess(), equalTo(false));
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SerializedThrowableTest method testSuppressedTransferring.
@Test
public void testSuppressedTransferring() {
Exception root = new Exception("root");
Exception suppressed = new Exception("suppressed");
root.addSuppressed(suppressed);
SerializedThrowable serializedThrowable = new SerializedThrowable(root);
assertEquals(1, serializedThrowable.getSuppressed().length);
Throwable actualSuppressed = serializedThrowable.getSuppressed()[0];
assertTrue(actualSuppressed instanceof SerializedThrowable);
assertEquals("suppressed", actualSuppressed.getMessage());
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SerializedThrowableTest method testCopySuppressed.
@Test
public void testCopySuppressed() {
Exception root = new Exception("root");
Exception suppressed = new Exception("suppressed");
root.addSuppressed(suppressed);
SerializedThrowable serializedThrowable = new SerializedThrowable(root);
SerializedThrowable copy = new SerializedThrowable(serializedThrowable);
assertEquals(1, copy.getSuppressed().length);
Throwable actualSuppressed = copy.getSuppressed()[0];
assertTrue(actualSuppressed instanceof SerializedThrowable);
assertEquals("suppressed", actualSuppressed.getMessage());
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SerializedThrowableTest method testIdenticalMessageAndStack.
@Test
public void testIdenticalMessageAndStack() {
try {
IllegalArgumentException original = new IllegalArgumentException("test message");
SerializedThrowable serialized = new SerializedThrowable(original);
assertEquals(original.getMessage(), serialized.getMessage());
assertEquals(original.toString(), serialized.toString());
assertEquals(ExceptionUtils.stringifyException(original), ExceptionUtils.stringifyException(serialized));
assertArrayEquals(original.getStackTrace(), serialized.getStackTrace());
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SerializedThrowableTest method testCopyPreservesCause.
@Test
public void testCopyPreservesCause() {
Exception original = new Exception("original message");
Exception parent = new Exception("parent message", original);
SerializedThrowable serialized = new SerializedThrowable(parent);
assertNotNull(serialized.getCause());
SerializedThrowable copy = new SerializedThrowable(serialized);
assertEquals("parent message", copy.getMessage());
assertNotNull(copy.getCause());
assertEquals("original message", copy.getCause().getMessage());
}
Aggregations