[
https://issues.apache.org/jira/browse/BEAM-6005?focusedWorklogId=163507&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-163507
]
ASF GitHub Bot logged work on BEAM-6005:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Nov/18 17:25
Start Date: 07/Nov/18 17:25
Worklog Time Spent: 10m
Work Description: supercclank commented on a change in pull request
#6923: [BEAM-6005] PCollectionCustomCoderTest updates to fix test to actually
function.
URL: https://github.com/apache/beam/pull/6923#discussion_r231599120
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/coders/PCollectionCustomCoderTest.java
##########
@@ -148,104 +161,179 @@ private void throwIfPresent(String exceptionClassName)
throws IOException {
@Test
@Category(NeedsRunner.class)
public void testDecodingIOException() throws Exception {
- thrown.expect(Exception.class);
- thrown.expectCause(instanceOf(IOException.class));
Pipeline p =
- runPipelineWith(new CustomTestCoder(IO_EXCEPTION, null, null, null,
EXCEPTION_MESSAGE));
+ pipelineWith(new CustomTestCoder(IO_EXCEPTION, null, null, null,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.io.IOException: Super Unique
Message!!!"));
p.run().waitUntilFinish();
}
@Test
@Category(NeedsRunner.class)
public void testDecodingNPException() throws Exception {
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("java.lang.NullPointerException: Super Unique
Message!!!");
-
Pipeline p =
- runPipelineWith(
+ pipelineWith(
new CustomTestCoder(NULL_POINTER_EXCEPTION, null, null, null,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.lang.NullPointerException: Super
Unique Message!!!"));
+
+ p.run().waitUntilFinish();
}
@Test
@Category(NeedsRunner.class)
public void testEncodingIOException() throws Exception {
+ Pipeline p =
+ pipelineWith(new CustomTestCoder(null, IO_EXCEPTION, null, null,
EXCEPTION_MESSAGE));
thrown.expect(Exception.class);
- thrown.expectCause(instanceOf(IOException.class));
+ thrown.expect(new ExceptionMatcher("java.io.IOException: Super Unique
Message!!!"));
- Pipeline p =
- runPipelineWith(new CustomTestCoder(null, IO_EXCEPTION, null, null,
EXCEPTION_MESSAGE));
+ p.run().waitUntilFinish();
}
@Test
@Category(NeedsRunner.class)
public void testEncodingNPException() throws Exception {
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("java.lang.NullPointerException: Super Unique
Message!!!");
Pipeline p =
- runPipelineWith(
+ pipelineWith(
new CustomTestCoder(null, NULL_POINTER_EXCEPTION, null, null,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.lang.NullPointerException: Super
Unique Message!!!"));
+ p.run().waitUntilFinish();
}
@Test
@Category(NeedsRunner.class)
public void testSerializationIOException() throws Exception {
- thrown.expect(Exception.class);
- thrown.expectCause(instanceOf(IOException.class));
Pipeline p =
- runPipelineWith(new CustomTestCoder(null, null, IO_EXCEPTION, null,
EXCEPTION_MESSAGE));
+ pipelineWith(new CustomTestCoder(null, null, IO_EXCEPTION, null,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.io.IOException: Super Unique
Message!!!"));
+ p.run().waitUntilFinish();
}
@Test
@Category(NeedsRunner.class)
public void testSerializationNPException() throws Exception {
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("java.lang.NullPointerException: Super Unique
Message!!!");
-
Pipeline p =
- runPipelineWith(
+ pipelineWith(
new CustomTestCoder(null, null, NULL_POINTER_EXCEPTION, null,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.lang.NullPointerException: Super
Unique Message!!!"));
+
+ p.run().waitUntilFinish();
}
+ // TODO(BEAM-6004) Have DirectRunner trigger deserialization.
+ @Ignore("DirectRunner doesn't decode coders so this test does not pass.")
@Test
@Category(NeedsRunner.class)
public void testDeserializationIOException() throws Exception {
- thrown.expect(Exception.class);
- thrown.expectCause(instanceOf(IOException.class));
Pipeline p =
- runPipelineWith(new CustomTestCoder(null, null, null, IO_EXCEPTION,
EXCEPTION_MESSAGE));
+ pipelineWith(new CustomTestCoder(null, null, null, IO_EXCEPTION,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
+ thrown.expect(new ExceptionMatcher("java.io.IOException: Super Unique
Message!!!"));
+ p.run().waitUntilFinish();
}
+ // TODO(BEAM-6004) Have DirectRunner trigger deserialization.
+ @Ignore("DirectRunner doesn't decode coders so this test does not pass.")
@Test
@Category(NeedsRunner.class)
public void testDeserializationNPException() throws Exception {
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("java.lang.NullPointerException: Super Unique
Message!!!");
-
Pipeline p =
- runPipelineWith(
+ pipelineWith(
new CustomTestCoder(null, null, null, NULL_POINTER_EXCEPTION,
EXCEPTION_MESSAGE));
+ thrown.expect(Exception.class);
Review comment:
Here as well
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 163507)
> PCollectionCustomCoderTest passes spuriously.
> ---------------------------------------------
>
> Key: BEAM-6005
> URL: https://issues.apache.org/jira/browse/BEAM-6005
> Project: Beam
> Issue Type: Bug
> Components: testing
> Reporter: Jason Kuster
> Assignee: Jason Kuster
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The test assertions trigger before the coder is used on the actual runner.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)