@Test public void testUnsupportedOperationExceptionWhenSpecifyingPartitionHandler() { // given PartitionHandler partitionHandler = Mockito.mock(PartitionHandler.class); this.expectedException.expect(UnsupportedOperationException.class); this.expectedException.expectMessage("When configuring a master step " + "for remote partitioning using the RemotePartitioningMasterStepBuilder, " + "the partition handler will be automatically set to an instance " + "of MessageChannelPartitionHandler. The partition handler must " + "not be provided in this case."); // when new RemotePartitioningMasterStepBuilder("step").partitionHandler(partitionHandler); // then // expected exception }