Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix unfinished stubbing of command response writer #10605

Merged
merged 2 commits into from
Oct 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,29 @@ public final class CreateProcessInstanceWithResultTest {
@ClassRule public static final EngineRule ENGINE = EngineRule.singlePartition();
private static final BpmnModelInstance PROCESS =
Bpmn.createExecutableProcess("PROCESS").startEvent().endEvent().done();
private static ProcessInstanceResultRecord response;
private static CommandResponseWriter mockCommandResponseWriter;

@Rule
public final RecordingExporterTestWatcher recordingExporterTestWatcher =
new RecordingExporterTestWatcher();

private ProcessInstanceResultRecord response;
private CommandResponseWriter mockCommandResponseWriter;

@BeforeClass
public static void init() {
ENGINE.deployment().withXmlResource(PROCESS).deploy();
}

@Before
public void setUp() {
@BeforeClass
public static void setUp() {
lenaschoenburg marked this conversation as resolved.
Show resolved Hide resolved
mockCommandResponseWriter = ENGINE.getCommandResponseWriter();
Mockito.clearInvocations(mockCommandResponseWriter);
interceptResponseWriter(mockCommandResponseWriter);
}

@Before
public void reset() {
Mockito.clearInvocations(mockCommandResponseWriter);
}

@Test
public void shouldSendResultAfterCompletion() {
// given
Expand Down Expand Up @@ -159,7 +162,8 @@ public void shouldSendRejectionImmediately() {
verify(ENGINE.getCommandResponseWriter(), timeout(1000).times(1)).tryWriteResponse(3, 3);
}

private void interceptResponseWriter(final CommandResponseWriter mockCommandResponseWriter) {
private static void interceptResponseWriter(
final CommandResponseWriter mockCommandResponseWriter) {
doAnswer(
(Answer<CommandResponseWriter>)
(invocation -> {
Expand Down