### Question:
VavrValueArgumentFactory implements ArgumentFactory { @Override public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { Class<?> rawType = GenericTypes.getErasedType(type); if (VALUE_CLASSES.stream().anyMatch(vc -> vc.isAssignableFrom(rawType))) { return buildValueArgument(type, config, (Value) value); } return Optional.empty(); }  @Override Optional<Argument> build(Type type, Object value, ConfigRegistry config);  }### Answer:
@Test public void testGetLeftEitherArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(EITHER_STRING_INTEGER, Either.left("error"), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetRightEitherArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(EITHER_STRING_INTEGER, Either.right(1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetRightEitherArgumentInferredShouldNotBeEmpty() { Optional<Argument> arg = unit.build(EITHER_WILDCARD, Either.right(1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetValidValidationArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(VALIDATION_STRING_INT, Validation.valid(1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetInvalidValidationArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(VALIDATION_STRING_INT, Validation.invalid("error"), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetArgumentForNull() { Optional<Argument> arg = unit.build(OPTION_INTEGER, null, configRegistry); assertThat(((NullArgument) arg.get()).getSqlType()) .isEqualTo(Types.INTEGER); }
@Test public void testGetArgumentNotPartOfFactoryShouldBeEmpty() { Optional<Argument> arg = unit.build(new GenericType<Integer>() {}.getType(), null, configRegistry); assertThat(arg).isEmpty(); }
@Test public void testGetNonValueArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(OPTION_INTEGER, Option.of(1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetArgumentOfNoneShouldNotBeEmpty() { Optional<Argument> arg = unit.build(OPTION_INTEGER, Option.none(), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetLazyArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(LAZY_INTEGER, Lazy.of(() -> 1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetLazyArgumentInferredShouldNotBeEmpty() { Optional<Argument> arg = unit.build(LAZY_WILDCARD, Lazy.of(() -> 1), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetBadLazyArgumentShouldThrow() { Lazy<Object> badEvaluatingLazy = Lazy.of(() -> { throw new TestSpecificException(); }); assertThatThrownBy(() -> unit.build(LAZY_INTEGER, badEvaluatingLazy, configRegistry)) .isInstanceOf(TestSpecificException.class); }
@Test public void testGetFailedTryArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(TRY_INTEGER, Try.failure(new TestSpecificException()), configRegistry); assertThat(arg).isNotEmpty(); }
@Test public void testGetSuccessTryArgumentShouldNotBeEmpty() { Optional<Argument> arg = unit.build(TRY_INTEGER, Try.failure(new TestSpecificException()), configRegistry); assertThat(arg).isNotEmpty(); }