コード例 #1
0
  @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);
  }
コード例 #2
0
  @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");
  }