### Question:
TypeTypeConverter implements TypeConverter { @Override public Object fromString(Type ignored, String value) { if (value == null) { return Expression.Undefined.class; } Type result = stringToTypeCache.get(value); if (result == null) { result = convertString(value); Type prev = stringToTypeCache.putIfAbsent(value, result); result = prev != null ? prev : result; } return result; }  @Override boolean isApplicable(Type type); @Override Object fromString(Type ignored, String value); @Override String toString(Type ignored, Object value);  }### Answer:
@Test void shouldThrowExceptionWhenClassToConvertDoesNotExist() { String toConvert = "UnknownClass"; assertThatThrownBy(() -> typeConverter.fromString(null, toConvert)) .isExactlyInstanceOf(IllegalArgumentException.class); }
@Test void shouldThrowExceptionWhenNestedClassToConvertDoesNotExist() { String toConvert = "UnknownClass.UnknownNestedClass"; assertThatThrownBy(() -> typeConverter.fromString(null, toConvert)) .isExactlyInstanceOf(IllegalArgumentException.class); }
@Test void shouldThrowExceptionWhenWrongTypeNameFormat() { String toConvert = "%&^"; assertThatThrownBy(() -> typeConverter.fromString(null, toConvert)) .isExactlyInstanceOf(IllegalArgumentException.class); }
@Test void shouldProperlyConvertFromNullType() { Class<?> converted = typeConverter.fromString(null, null); assertThat(converted).isEqualTo(Expression.Undefined.class); }
@Test void shouldProperlyConvertAliasTypeFromFullyQualifiedString() { Type converted = typeConverter.fromString(null, "java.lang.String"); assertThat(converted).isEqualTo(String.class); }