@Bean public IntegrationFlow workerIntegrationFlow() { return this.remoteChunkingWorkerBuilder .itemProcessor(itemProcessor()) .itemWriter(itemWriter()) .inputChannel(requests()) .outputChannel(replies()) .build(); }
@Test public void testMandatoryItemWriter() { // given RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<>(); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("An ItemWriter must be provided"); // when builder.build(); // then // expected exception }
@Test public void itemWriterMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("itemWriter must not be null"); // when IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>() .itemWriter(null) .build(); // then // expected exception }
@Test public void testMandatoryInputChannel() { // given RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>() .itemWriter(items -> { }); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("An InputChannel must be provided"); // when builder.build(); // then // expected exception }
@Test public void itemProcessorMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("itemProcessor must not be null"); // when IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>() .itemProcessor(null) .build(); // then // expected exception }
@Test public void outputChannelMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("outputChannel must not be null"); // when IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>() .outputChannel(null) .build(); // then // expected exception }
@Test public void inputChannelMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("inputChannel must not be null"); // when IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>() .inputChannel(null) .build(); // then // expected exception }
@Test public void testMandatoryOutputChannel() { // given RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>() .itemWriter(items -> { }) .inputChannel(new DirectChannel()); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("An OutputChannel must be provided"); // when builder.build(); // then // expected exception }
@Test public void testIntegrationFlowCreation() { // given DirectChannel inputChannel = new DirectChannel(); DirectChannel outputChannel = new DirectChannel(); RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>() .itemProcessor(this.itemProcessor) .itemWriter(this.itemWriter) .inputChannel(inputChannel) .outputChannel(outputChannel); // when IntegrationFlow integrationFlow = builder.build(); // then Assert.assertNotNull(integrationFlow); }