@Test public void shouldCallServiceWithEmptyValueIfNotSendingOptionalParameter() { // Given Mapping mapping = new MappingBuilder(OPERATION_FIELD_NAME).build(); MappedApi service = service(mapping); // When service.optionalMappedCall(null); receive(captureMessage(), mapping); // Then verify(serviceMock).optionalMappedCall(null); }
@Test public void shouldCallServiceWithDefaultValueIfNotSendingOptionalParameter() { // Given Mapping mapping = new MappingBuilder(OPERATION_FIELD_NAME) .mapField("string", FieldMapping.mapWithDefault("string", "default value")) .build(); MappedApi service = service(mapping); // When service.optionalMappedCall(null); receive(captureMessage(), mapping); // Then verify(serviceMock).optionalMappedCall("default value"); }