Skip to content

Commit

Permalink
merge: #10639
Browse files Browse the repository at this point in the history
10639: [Backport stable/8.1] test: fix unfinished stubbing of command response writer r=oleschoenburg a=backport-action

# Description
Backport of #10605 to `stable/8.1`.

relates to #10604

Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
  • Loading branch information
zeebe-bors-camunda[bot] and oleschoenburg committed Oct 7, 2022
2 parents 19c50e5 + 49e1412 commit aa574c4
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,23 @@ 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() {
mockCommandResponseWriter = ENGINE.getCommandResponseWriter();
interceptResponseWriter(mockCommandResponseWriter);
ENGINE.deployment().withXmlResource(PROCESS).deploy();
}

@Before
public void setUp() {
mockCommandResponseWriter = ENGINE.getCommandResponseWriter();
public void reset() {
Mockito.clearInvocations(mockCommandResponseWriter);
interceptResponseWriter(mockCommandResponseWriter);
}

@Test
Expand Down Expand Up @@ -159,7 +158,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

0 comments on commit aa574c4

Please sign in to comment.