### Question:
DeploymentPostProcessor extends BeanInfoPostProcessor { @Override public Consumer<ZeebeClient> apply(final ClassInfo beanInfo) { final ZeebeDeploymentValue value = reader.applyOrThrow(beanInfo); log.info("deployment: {}", value); return client -> { DeployWorkflowCommandStep1 deployWorkflowCommand = client .newDeployCommand(); DeploymentEvent deploymentResult = value.getClassPathResources() .stream() .map(deployWorkflowCommand::addResourceFromClasspath) .reduce((first, second) -> second) .orElseThrow(() -> new IllegalArgumentException("Requires at least one resource to deploy")) .send() .join(); log.info( "Deployed: {}", deploymentResult .getWorkflows() .stream() .map(wf -> String.format("<%s:%d>", wf.getBpmnProcessId(), wf.getVersion())) .collect(Collectors.joining(","))); }; }  @Override boolean test(final ClassInfo beanInfo); @Override Consumer<ZeebeClient> apply(final ClassInfo beanInfo);  }### Answer:
@Test public void shouldDeploySingleResourceTest() { ClassInfo classInfo = ClassInfo.builder() .build(); ZeebeDeploymentValue zeebeDeploymentValue = ZeebeDeploymentValue.builder() .classPathResources(Collections.singletonList("/1.bpmn")) .build(); when(reader.applyOrThrow(classInfo)).thenReturn(zeebeDeploymentValue); when(client.newDeployCommand()).thenReturn(deployStep1); when(deployStep1.addResourceFromClasspath(anyString())).thenReturn(deployStep2); when(deployStep2.send()).thenReturn(zeebeFuture); when(zeebeFuture.join()).thenReturn(deploymentEvent); when(deploymentEvent.getWorkflows()).thenReturn(Collections.singletonList(getWorkFlow())); deploymentPostProcessor.apply(classInfo).accept(client); verify(deployStep1).addResourceFromClasspath(eq("/1.bpmn")); verify(deployStep2).send(); verify(zeebeFuture).join(); }
@Test public void shouldDeployMultipleResourcesTest() { ClassInfo classInfo = ClassInfo.builder() .build(); ZeebeDeploymentValue zeebeDeploymentValue = ZeebeDeploymentValue.builder() .classPathResources(Arrays.asList("/1.bpmn", "/2.bpmn")) .build(); when(reader.applyOrThrow(classInfo)).thenReturn(zeebeDeploymentValue); when(client.newDeployCommand()).thenReturn(deployStep1); when(deployStep1.addResourceFromClasspath(anyString())).thenReturn(deployStep2); when(deployStep2.send()).thenReturn(zeebeFuture); when(zeebeFuture.join()).thenReturn(deploymentEvent); when(deploymentEvent.getWorkflows()).thenReturn(Collections.singletonList(getWorkFlow())); deploymentPostProcessor.apply(classInfo).accept(client); verify(deployStep1).addResourceFromClasspath(eq("/1.bpmn")); verify(deployStep1).addResourceFromClasspath(eq("/2.bpmn")); verify(deployStep2).send(); verify(zeebeFuture).join(); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnNoResourcesToDeploy() { ClassInfo classInfo = ClassInfo.builder() .build(); ZeebeDeploymentValue zeebeDeploymentValue = ZeebeDeploymentValue.builder() .classPathResources(Collections.emptyList()) .build(); when(reader.applyOrThrow(classInfo)).thenReturn(zeebeDeploymentValue); when(client.newDeployCommand()).thenReturn(deployStep1); when(deployStep1.addResourceFromClasspath(anyString())).thenReturn(deployStep2); deploymentPostProcessor.apply(classInfo).accept(client); }