target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void shouldNotBeApplicableWhenNotCurrencyType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str...
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str...
@Test public void shouldThrowExceptionWhenIsApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str...
CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str...
@Test void shouldThrowExceptionWhenTypeIsNullAndIsApplicable() { assertThatThrownBy(() -> typeConverter.isApplicable(null, null)) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, YAML); }
YamlConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, YAML); } }
YamlConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, YAML); } Ya...
YamlConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, YAML); } Ya...
YamlConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, YAML); } Ya...
@Test public void shouldConvertToString() { Currency toConvert = Currency.getInstance("USD"); String converted = converter.toString(Currency.class, toConvert, emptyMap()); assertThat(converted).isEqualTo("USD"); }
@Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
@Test public void shouldReturnNullWhenToStringAndValueIsNull() { String converted = converter.toString(Currency.class, null, emptyMap()); assertThat(converted).isNull(); }
@Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
@Test public void shouldThrowExceptionWhenToStringAndTypeIsNull() { Currency toConvert = Currency.getInstance("USD"); assertThatThrownBy(() -> converter.toString(null, toConvert, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
CurrencyConverter implements TypeConverter<Currency> { @Override public String toString(Type type, Currency value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.getCurrencyCode(); } @Override boolean isApplicable(Type type, Map<String, String> attrib...
@Test public void shouldConvertFromString() { String toConvert = "USD"; Currency converted = converter.fromString(Currency.class, toConvert, emptyMap()); assertThat(converted).isEqualTo(Currency.getInstance("USD")); }
@Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
@Test public void shouldThrowExceptionWhenInvalidFormat() { String toConvert = "invalid"; assertThatThrownBy(() -> converter.fromString(Currency.class, toConvert, emptyMap())) .isExactlyInstanceOf(IllegalArgumentException.class); }
@Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
@Test public void shouldReturnNullWhenFromStringAndValueIsNull() { Currency converted = converter.fromString(Currency.class, null, emptyMap()); assertThat(converted).isNull(); }
@Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
@Test public void shouldThrowExceptionWhenFromStringAndTypeIsNull() { String toConvert = "USD"; assertThatThrownBy(() -> converter.fromString(null, toConvert, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } }
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
CurrencyConverter implements TypeConverter<Currency> { @Override public Currency fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : Currency.getInstance(value); } @Override boolean isApplicable(Type type, Map<String, String> ...
@Test public void shouldBeApplicableWhenBooleanType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
@Test public void shouldNotBeApplicableWhenNotBooleanType() { Type type = Integer.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } }
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
BooleanConverter implements TypeConverter<Boolean> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Boolean.class.isAssignableFrom((Class<?>) type) || Boolean.TYPE.isAssignableFrom((Class<?>) type)); } ...
@Test void shouldConvertFromString() { String toConvert = "" + "integer: 1\n" + "string: test-1\n"; TestClass converted = typeConverter.fromString(TestClass.class, toConvert, null); assertThat(converted).isEqualTo(new TestClass(1, "test-1")); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldConvertToStringWhenFormatNotSpecifiedAndTrue() { Boolean b = true; String converted = converter.toString(Boolean.class, b, emptyMap()); assertThat(converted).isEqualTo("true"); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldConvertToStringWhenFormatNotSpecifiedAndFalse() { Boolean b = false; String converted = converter.toString(Boolean.class, b, emptyMap()); assertThat(converted).isEqualTo("false"); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndTrue() { Boolean b = true; String format = "yes/no"; Map<String, String> attributes = singletonMap("format", format); String converted = converter.toString(Boolean.class, b, attributes); assertThat(converted).isEqualTo("yes"); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndFalse() { Boolean b = false; String format = "yes/no"; Map<String, String> attributes = singletonMap("format", format); String converted = converter.toString(Boolean.class, b, attributes); assertThat(converted).isEqualTo("no"); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldReturnNullWhenConvertingToStringAndValueToConvertIsNull() { String converted = converter.toString(Boolean.class, null, emptyMap()); assertThat(converted).isNull(); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldThrowExceptionWhenConvertingToStringAndWrongFormat() { Boolean toConvert = true; String format = "wrong format"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.toString(Boolean.class, toConvert, attributes)) .isExactlyInstanceOf(IllegalArgumen...
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongValue() { String aString = "wrong value"; assertThatThrownBy(() -> converter.fromString(Boolean.class, aString, null)) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Unable to convert to Boolean. Unknown value:"); }
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldThrowExceptionWhenConvertingToStringAndTypeIsNull() { Boolean b = true; assertThatThrownBy(() -> converter.toString(null, b, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values = cache.computeIfAbsent(format, this::getValues); retu...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
BooleanConverter implements TypeConverter<Boolean> { @Override public String toString(Type type, Boolean value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (attributes != null && attributes.containsKey(FORMAT)) { String format = attributes.get(FORMAT); Pair<String, String> values =...
@Test public void shouldConvertFromStringWhenFormatNotSpecifiedAndTrue() { String booleanInString = "true"; Boolean fromConversion = converter.fromString(Boolean.class, booleanInString, emptyMap()); assertThat(fromConversion).isEqualTo(true); }
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldConvertFromStringWhenFormatNotSpecifiedAndFalse() { String booleanInString = "false"; Boolean fromConversion = converter.fromString(Boolean.class, booleanInString, emptyMap()); assertThat(fromConversion).isEqualTo(false); }
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test void shouldConvertCollectionFromString() { String toConvert = "" + "- integer: 1\n" + " string: test-1\n" + "- integer: 2\n" + " string: test-2\n"; TypeConverter<List<TestClass>> typeConverter = new YamlConverter<>(); Collection<TestClass> converted = typeConverter.fromString(parameterize(Collection.class, TestCl...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldConvertFromStringWhenFormatSpecifiedAndTrue() { String booleanInString = "on"; String format = "on/off"; Map<String, String> attributes = singletonMap("format", format); Boolean fromConversion = converter.fromString(Boolean.class, booleanInString, attributes); assertThat(fromConversion).isEqualT...
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldConvertFromStringWhenFormatSpecifiedAndFalse() { String booleanInString = "off"; String format = "on/off"; Map<String, String> attributes = singletonMap("format", format); Boolean fromConversion = converter.fromString(Boolean.class, booleanInString, attributes); assertThat(fromConversion).isEqua...
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldReturnNullWhenConvertingFromStringAndValueToConvertIsNull() { Boolean fromConversion = converter.fromString(Boolean.class, null, emptyMap()); assertThat(fromConversion).isNull(); }
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongFormat() { String booleanInString = "on"; String format = "wrong format"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.fromString(Boolean.class, booleanInString, attributes)) .isExactlyInstanceOf...
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldThrowExceptionWhenConvertingFromStringWithFormatAndWrongValue() { String booleanInString = "wrong value"; String format = "yes/no"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.fromString(Boolean.class, booleanInString, attributes)) .isExact...
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndTypeIsNull() { String booleanInString = "on"; assertThatThrownBy(() -> converter.fromString(null, booleanInString, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { Pair<String, String> values = cache.computeIfAbsent(...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
BooleanConverter implements TypeConverter<Boolean> { @Override public Boolean fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) {...
@Test public void shouldBeApplicableWhenInstantType() { Type type = Instant.class; boolean applicable = instantConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
@Test public void shouldNotBeApplicableWhenNotInstantType() { Type type = Boolean.class; boolean applicable = instantConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> instantConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } }
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Instant.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type...
@Test public void shouldConvertToStringWhenFormatNotSpecified() { Instant toConvert = Instant.EPOCH; String converted = instantConverter.toString(Instant.class, toConvert, emptyMap()); assertThat(converted).isEqualTo("1970-01-01T00:00:00Z"); }
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test void shouldConvertMapFromString() { String toConvert = "" + "first:\n" + " integer: 1\n" + " string: test-1\n" + "second:\n" + " integer: 2\n" + " string: test-2\n"; TypeConverter<Map<String, TestClass>> typeConverter = new YamlConverter<>(); Map<String, TestClass> converted = typeConverter.fromString(parameteriz...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndDefaultZone() { Instant toConvert = Instant.EPOCH; String format = "yyyy MM dd HH:mm"; Map<String, String> attributes = singletonMap("format", format); String converted = instantConverter.toString(Instant.class, toConvert, attributes); assertThat(converted).i...
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldConvertToStringWhenFormatAndZoneSpecified() { Instant toConvert = Instant.EPOCH; String format = "yyyy MM dd HH:mm"; Map<String, String> attributes = new HashMap<>(); attributes.put("format", format); attributes.put("zone", "Europe/London"); String converted = instantConverter.toString(Instant.c...
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndWrongZone() { Instant toConvert = Instant.EPOCH; String format = "yyyy MM dd HH:mm"; Map<String, String> attributes = new HashMap<>(); attributes.put("zone", "null"); attributes.put("format", format); String converted = instantConverter.toString(Instant.class...
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldReturnNullWhenConvertingToStringAndValueToConvertIsNull() { String converted = instantConverter.toString(Instant.class, null, emptyMap()); assertThat(converted).isNull(); }
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldThrowExceptionWhenConvertingToStringAndWrongFormat() { Instant toConvert = Instant.EPOCH; String format = "invalid format"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> instantConverter.toString(Instant.class, toConvert, attributes)) .isExactlyInstanc...
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldThrowExceptionWhenConvertingToStringAndTypeIsNull() { Instant toConvert = Instant.EPOCH; assertThatThrownBy(() -> instantConverter.toString(null, toConvert, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndTypeIsNull() { Instant toConvert = Instant.EPOCH; assertThatThrownBy(() -> instantConverter.toString(null, toConvert, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) { format = attributes.get(FORMAT); String zone = attributes.get(ZONE);...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
InstantConverter extends AbstractTemporalAccessorConverter<Instant> { @Override public String toString(Type type, Instant value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = null; ZoneId zoneId = DEFAULT_ZONE; if (attributes != null) ...
@Test public void shouldBeApplicableWhenStringType() { Type type = String.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); @Ov...
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); @Ov...
@Test public void shouldNotBeApplicableWhenNotStringType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); @Ov...
StringConverter implements TypeConverter<String> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && String.class.isAssignableFrom((Class<?>) type); } StringConverter(boolean escape); StringConverter(); @Ov...
@Test public void shouldConvertFromStringWhenFormatNotSpecified() { String in = "One\\\\Two"; String expected = "One\\Two"; String out = converter.fromString(String.class, in, null); assertThat(out).isEqualTo(expected); }
@Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
@Test void shouldReturnNullWhenFromStringAndValueIsNull() { TestClass converted = typeConverter.fromString(TestClass.class, null, null); assertThat(converted).isNull(); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldExecuteMainWithoutExceptions() { GenericsExample.main(new String[0]); }
public static void main(String[] args) { new GenericsExample().run(); }
GenericsExample { public static void main(String[] args) { new GenericsExample().run(); } }
GenericsExample { public static void main(String[] args) { new GenericsExample().run(); } }
GenericsExample { public static void main(String[] args) { new GenericsExample().run(); } static void main(String[] args); }
GenericsExample { public static void main(String[] args) { new GenericsExample().run(); } static void main(String[] args); }
@Test public void shouldConvertFromStringWhenFormatSpecifiedAndFalse() { String in = "One\\\\Two"; String escape = "false"; Map<String, String> attributes = singletonMap("escape", escape); String out = converter.fromString(String.class, in, attributes); assertThat(out).isEqualTo(in); }
@Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
@Test public void shouldConvertFromStringWhenFormatSpecifiedAndTrue() { String in = "One\\\\Two"; String escape = "true"; Map<String, String> attributes = singletonMap("escape", escape); String out = converter.fromString(String.class, in, attributes); assertThat(out).isEqualTo("One\\Two"); }
@Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongEscapeValue() { String in = "One\\Two"; String escape = "wrong value"; Map<String, String> attributes = singletonMap("escape", escape); assertThatThrownBy(() -> converter.fromString(String.class, in, attributes)) .isExactlyInstanceOf(IllegalArgumentE...
@Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
StringConverter implements TypeConverter<String> { @Override public String fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? unescapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override bo...
@Test public void shouldConvertToStringWhenFormatNotSpecified() { String in = "One\\Two"; String expected = "One\\\\Two"; String out = converter.toString(String.class, in, null); assertThat(out).isEqualTo(expected); }
@Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndFalse() { String in = "One\\Two"; String escape = "false"; Map<String, String> attributes = singletonMap(ESCAPE, escape); String out = converter.toString(String.class, in, attributes); assertThat(out).isEqualTo(in); }
@Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
@Test public void shouldConvertToStringWhenFormatSpecifiedAndTrue() { String in = "One\\Two"; String escape = "true"; Map<String, String> attributes = singletonMap(ESCAPE, escape); String out = converter.toString(String.class, in, attributes); assertThat(out).isEqualTo("One\\\\Two"); }
@Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
@Test public void shouldThrowExceptionWhenConvertingToStringAndWrongEscapeValue() { String in = "One\\Two"; String escape = "wrong value"; Map<String, String> attributes = singletonMap(ESCAPE, escape); assertThatThrownBy(() -> converter.toString(String.class, in, attributes)) .isExactlyInstanceOf(IllegalArgumentExcepti...
@Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); }
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
StringConverter implements TypeConverter<String> { @Override public String toString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return shouldEscape(attributes) ? escapeJava(value) : value; } StringConverter(boolean escape); StringConverter(); @Override boolea...
@Test public void shouldProperlyIndicateSupportedTypes() { assertThat(typeConverter.isApplicable(SUPPORTED_LIST_TYPE, null)).isTrue(); assertThat(typeConverter.isApplicable(SUPPORTED_MAP_TYPE, null)).isTrue(); assertThat(typeConverter.isApplicable(SUPPORTED_COMPLEX_TYPE, null)).isTrue(); assertThat(typeConverter.isAppl...
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType() instanceof Class) { Class<?> rawType = (Class<?>) pa...
JsonLikeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType()...
JsonLikeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType()...
JsonLikeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType()...
JsonLikeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType()...
@Test public void shouldProperlyConsumeJsonNullsAndAddNullValuesToBuilder() { boolean compact = false; ObjectBuilder builder = Mockito.mock(ObjectBuilder.class); assertThat(typeConverter.consumeNull(JSON_NULL, 0, builder, compact)).isEqualTo(JSON_NULL.length()); assertThat(typeConverter.consumeNull(JSON_NULL + ',', 0, ...
int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + current) { found = notEscapedIndexOf(value, current, COMMA,...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
@Test public void shouldProperlyConsumeCompactJsonNullsAndAddNullValuesToBuilder() { boolean compact = true; ObjectBuilder builder = Mockito.mock(ObjectBuilder.class); assertThat(typeConverter.consumeNull(COMPACT_JSON_NULL, 0, builder, compact)).isEqualTo(COMPACT_JSON_NULL.length()); assertThat(typeConverter.consumeNul...
int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + current) { found = notEscapedIndexOf(value, current, COMMA,...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
JsonLikeConverter implements TypeConverter<Object> { int consumeNull(CharSequence value, int current, ObjectBuilder builder, boolean compact) { int found = value.length(); boolean consume = false; if (compact) { if (value.charAt(current) == COMPACT_JSON_NULL.charAt(0)) { if (found != COMPACT_JSON_NULL.length() + curren...
@Test void shouldThrowExceptionWhenImproperYamlFormat() { String toConvert = "" + "<integer>1</integer>" + "<string>test-1</string>"; assertThatThrownBy(() -> typeConverter.fromString(TestClass.class, toConvert, null)); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldSupportConvertersFromTheChain() { TypeConverter<?> converter = new ChainedTypeConverter(new StringConverter(false), new IntegerConverter()); assertThat(converter.isApplicable(String.class, null)).isTrue(); assertThat(converter.isApplicable(Integer.class, null)).isTrue(); assertThat(converter.isA...
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes, false) != null; }
ChainedTypeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes, false) != null; } }
ChainedTypeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes, false) != null; } ChainedTypeConverter(List<TypeConverter<?>> converters); ChainedTypeConverter(T...
ChainedTypeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes, false) != null; } ChainedTypeConverter(List<TypeConverter<?>> converters); ChainedTypeConverter(T...
ChainedTypeConverter implements TypeConverter<Object> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes, false) != null; } ChainedTypeConverter(List<TypeConverter<?>> converters); ChainedTypeConverter(T...
@Test public void shouldThrowIAEWhenTypeIsNotSupported() { assertThrows(IllegalArgumentException.class, () -> { TypeConverter<Object> converter = new ChainedTypeConverter(new StringConverter()); converter.fromString(Long.class, "10", null); }); }
@Override public Object fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes).fromString(type, value, attributes); }
ChainedTypeConverter implements TypeConverter<Object> { @Override public Object fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes).fromString(type, value, attributes); } }
ChainedTypeConverter implements TypeConverter<Object> { @Override public Object fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes).fromString(type, value, attributes); } ChainedTypeConverter(List<TypeConverter<?>> conv...
ChainedTypeConverter implements TypeConverter<Object> { @Override public Object fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes).fromString(type, value, attributes); } ChainedTypeConverter(List<TypeConverter<?>> conv...
ChainedTypeConverter implements TypeConverter<Object> { @Override public Object fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return converterFor(type, attributes).fromString(type, value, attributes); } ChainedTypeConverter(List<TypeConverter<?>> conv...
@Test public void shouldBeApplicableWhenFloatType() { Type type = Float.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldNotBeApplicableWhenNotFloatType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
FloatConverter extends AbstractNumberConverter<Float> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Float.class, Float.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldBeApplicableWhenUrlType() { Type type = URL.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
@Test public void shouldNotBeApplicableWhenNotUrlType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } }
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
UrlConverter implements TypeConverter<URL> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && URL.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, String> at...
@Test public void shouldConvertToString() throws MalformedURLException { String urlString = "http: URL toConvert = new URL(urlString); String converted = converter.toString(URL.class, toConvert, emptyMap()); assertThat(converted).isEqualTo(urlString); }
@Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override URL fromString(...
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override URL fromString(...
@Test public void shouldReturnNullWhenConvertingToStringAndValueToConvertIsNull() { String converted = converter.toString(URL.class, null, emptyMap()); assertThat(converted).isNull(); }
@Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } }
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override URL fromString(...
UrlConverter implements TypeConverter<URL> { @Override public String toString(Type type, URL value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override URL fromString(...
@Test void shouldThrowExceptionWhenTypeIsNullAndFromString() { assertThatThrownBy(() -> typeConverter.fromString(null, null, null)) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
YamlConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldCovertFromString() throws MalformedURLException { String urlInString = "http: URL fromConversion = converter.fromString(URL.class, urlInString, emptyMap()); URL expected = new URL(urlInString); assertThat(fromConversion).isEqualTo(expected); }
@Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(format("Unable to convert to URL: %s", value), e...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
@Test public void shouldThrowExceptionWhenMalformedUrl() { String malformedUrlString = "malformed URL"; assertThatThrownBy(() -> converter.fromString(URL.class, malformedUrlString, emptyMap())) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessage("Unable to convert to URL: malformed URL"); }
@Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(format("Unable to convert to URL: %s", value), e...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndTypeIsNull() { String urlInString = "http: assertThatThrownBy(() -> converter.fromString(null, urlInString, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(format("Unable to convert to URL: %s", value), e...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
@Test public void shouldReturnNullWhenConvertingFromStringAndValueToConvertIsNull() { URL fromConversion = converter.fromString(URL.class, null, emptyMap()); assertThat(fromConversion).isNull(); }
@Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(format("Unable to convert to URL: %s", value), e...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
UrlConverter implements TypeConverter<URL> { @Override public URL fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { return new URL(value); } catch (MalformedURLException e) { throw new IllegalArgumentException(for...
@Test public void shouldBeApplicableWhenShortType() { Type type = Short.class; boolean applicable = shortTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldNotBeApplicableWhenNotShortType() { Type type = Boolean.class; boolean applicable = shortTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> shortTypeConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
ShortConverter extends AbstractNumberConverter<Short> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Short.class, Short.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); }
@Test public void shouldAcceptEnumType() { Type type = TestEnum.class; boolean isApplicable = enumTypeAdapter.isApplicable(type, null); assertThat(isApplicable).isTrue(); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Enum.class.isAssignableFrom((Class<?>) type); }
EnumConverter implements TypeConverter<Enum<?>> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Enum.class.isAssignableFrom((Class<?>) type); } }
EnumConverter implements TypeConverter<Enum<?>> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Enum.class.isAssignableFrom((Class<?>) type); } }
EnumConverter implements TypeConverter<Enum<?>> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Enum.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, Stri...
EnumConverter implements TypeConverter<Enum<?>> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Enum.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, Stri...
@Test public void shouldConvertFromString() { Enum<?> testEnum = enumTypeAdapter.fromString(TestEnum.class, "FIRST", null); assertThat(testEnum).isEqualTo(TestEnum.FIRST); }
@SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } @Override boolean isApp...
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } @Override boolean isApp...
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongValue() { String value = "WRONG_VALUE"; assertThatThrownBy(() -> enumTypeAdapter.fromString(TestEnum.class, value, null)) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Unable to convert a value to an enumeration:"); }
@SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } }
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } @Override boolean isApp...
EnumConverter implements TypeConverter<Enum<?>> { @SuppressWarnings("unchecked") @Override public Enum<?> fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : toEnumValue((Class<Enum<?>>) type, value); } @Override boolean isApp...
@Test void shouldConvertToString() { TestClass toConvert = new TestClass(1, "test-1"); String converted = typeConverter.toString(TestClass.class, toConvert, null); assertThat(converted).isEqualTo("" + "integer: 1\n" + "string: test-1\n"); }
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
@Test public void shouldConvertToString() { String value = enumTypeAdapter.toString(TestEnum.class, TestEnum.SECOND_VALUE, null); assertThat(value).isEqualTo(TestEnum.SECOND_VALUE.name()); }
@Override public String toString(Type type, Enum<?> value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.name(); }
EnumConverter implements TypeConverter<Enum<?>> { @Override public String toString(Type type, Enum<?> value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.name(); } }
EnumConverter implements TypeConverter<Enum<?>> { @Override public String toString(Type type, Enum<?> value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.name(); } }
EnumConverter implements TypeConverter<Enum<?>> { @Override public String toString(Type type, Enum<?> value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.name(); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @SuppressW...
EnumConverter implements TypeConverter<Enum<?>> { @Override public String toString(Type type, Enum<?> value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : value.name(); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @SuppressW...
@Test public void decryptUnencryptedValueAndResetProvider() { String encrypted = "encrypted"; String decrypted = "decrypted"; ConfigurationValue value = new ConfigurationValue(null, encrypted, true, Encrypted.DEFAULT, null); processor = new ConfigurationValueDecryptingProcessor(decrypter); when(decrypter.getName()).the...
@Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value.getValue(); String decrypted = decrypter.decrypt(encrypted); value.setDecrypted...
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
@Test public void shouldNotDecryptUnencryptedValue() { String val = "value"; ConfigurationValue value = new ConfigurationValue(null, val, true, null, null); processor = new ConfigurationValueDecryptingProcessor(decrypter); processor.process(value); assertThat(value.isEncrypted()).isFalse(); assertThat(value.getValue())...
@Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value.getValue(); String decrypted = decrypter.decrypt(encrypted); value.setDecrypted...
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
@Test public void shouldNotDecryptEncryptedValueWhenProviderNameDiffers() { String encrypted = "encrypted"; String decrypted = "decrypted"; String encryptionProvider = Encrypted.DEFAULT; ConfigurationValue value = new ConfigurationValue(null, encrypted, true, encryptionProvider, null); processor = new ConfigurationValu...
@Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value.getValue(); String decrypted = decrypter.decrypt(encrypted); value.setDecrypted...
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
@Test public void shouldThrowIllegalArgumentExceptionFromNoOpConfigurationValueDecrypter() { assertThrows(IllegalArgumentException.class, () -> { processor = new ConfigurationValueDecryptingProcessor(); processor.process(new ConfigurationValue(null, null, true, Encrypted.DEFAULT, null)); }); }
@Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value.getValue(); String decrypted = decrypter.decrypt(encrypted); value.setDecrypted...
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
ConfigurationValueDecryptingProcessor implements ConfigurationValueProcessor { @Override public ConfigurationValue process(ConfigurationValue value) { requireNonNull(value, "value cannot be null"); if (value.isEncrypted() && Objects.equals(value.getEncryptionProvider(), decrypter.getName())) { String encrypted = value....
@Test void shouldConvertCollectionToString() { List<TestClass> toConvert = asList( new TestClass(1, "test-1"), new TestClass(2, "test-2") ); TypeConverter<List<TestClass>> typeConverter = new YamlConverter<>(); String converted = typeConverter.toString(parameterize(Collection.class, TestClass.class), toConvert, null); ...
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
@Test void shouldConvertMapToString() { Map<String, TestClass> toConvert = new HashMap<>(); toConvert.put("first", new TestClass(1, "test-1")); toConvert.put("second", new TestClass(2, "test-2")); TypeConverter<Map<String, TestClass>> typeConverter = new YamlConverter<>(); String converted = typeConverter.toString(para...
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
@Test void shouldReturnNullWhenToStringAndValueIsNull() { String converted = typeConverter.toString(TestClass.class, null, null); assertThat(converted).isNull(); }
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
@Test void shouldThrowExceptionWhenTypeIsNullAndToString() { assertThatThrownBy(() -> typeConverter.toString(null, null, null)) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
YamlConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
@Test void shouldThrowExceptionWhenTypeIsNullAndIsApplicable() { assertThatThrownBy(() -> typeConverter.isApplicable(null, null)) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, JSON); }
JsonConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, JSON); } }
JsonConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, JSON); } Js...
JsonConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, JSON); } Js...
JsonConverter implements TypeConverter<T> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String converter = (attributes == null) ? null : attributes.get(CONVERTER); return ignoreConverterAttribute || Objects.equals(converter, JSON); } Js...
@Test void shouldConvertFromString() { String toConvert = "" + "{" + " \"integer\": \"10\"," + " \"string\": \"test\"" + "}"; TestClass converted = typeConverter.fromString(TestClass.class, toConvert, null); assertThat(converted).isNotNull(); assertThat(converted.integer).isEqualTo(10); assertThat(converted.string).isE...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldConvertListFromString() { String toConvert = "" + "[" + " {" + " \"integer\": \"1\"," + " \"string\": \"test-1\"" + " }," + " {" + " \"integer\": \"2\"," + " \"string\": \"test-2\"" + " }" + "]"; TypeConverter<List<TestClass>> listConverter = new JsonConverter<>(); List<TestClass> converted = listConve...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test public void shouldExecuteMainWithoutExceptions() { MetaDataExample.main(new String[0]); }
public static void main(String[] args) { new MetaDataExample().run(); }
MetaDataExample { public static void main(String[] args) { new MetaDataExample().run(); } }
MetaDataExample { public static void main(String[] args) { new MetaDataExample().run(); } }
MetaDataExample { public static void main(String[] args) { new MetaDataExample().run(); } static void main(String[] args); }
MetaDataExample { public static void main(String[] args) { new MetaDataExample().run(); } static void main(String[] args); }
@Test void shouldConvertMapFromString() { String toConvert = "" + "{" + " \"one\": {" + " \"integer\": \"1\"," + " \"string\": \"test-1\"" + " }," + " \"two\": {" + " \"integer\": \"2\"," + " \"string\": \"test-2\"" + " }" + "}"; TypeConverter<Map<String, TestClass>> listConverter = new JsonConverter<>(); Map<String, T...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldThrowAssertionErrorWhenTryToConvertFromStringWithInvalidProperty() { String toConvert = "" + "{" + " \"int\": \"10\"," + " \"string\": \"test\"" + "}"; assertThatThrownBy(() -> typeConverter.fromString(TestClass.class, toConvert, null)) .isExactlyInstanceOf(IllegalStateException.class) .hasCauseInstanc...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldThrowAssertionErrorWhenTryToConvertFromInvalidJsonString() { String toConvert = "" + " \"integer\": \"10\"," + " \"string\": \"test\"" + "}"; assertThatThrownBy(() -> typeConverter.fromString(TestClass.class, toConvert, null)) .isExactlyInstanceOf(IllegalStateException.class) .hasCauseInstanceOf(IOExce...
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldReturnNullWhenFromStringAndValueIsNull() { TestClass converted = typeConverter.fromString(TestClass.class, null, null); assertThat(converted).isNull(); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldThrowExceptionWhenTypeIsNullAndFromString() { assertThatThrownBy(() -> typeConverter.fromString(null, null, null)) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); }
@Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = objectMapper.readerFor(javaType); return obje...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
JsonConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { JavaType javaType = TypeFactory.defaultInstance().constructType(type); ObjectReader objectReader = o...
@Test void shouldConvertToString() { TestClass toConvert = new TestClass(); toConvert.integer = 10; toConvert.string = "test"; String converted = typeConverter.toString(TestClass.class, toConvert, null); assertThat(converted).isEqualTo("" + "{" + "\"integer\":10," + "\"string\":\"test\"" + "}"); }
@Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } catch (JsonProcessingException e) { throw new ...
JsonConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
JsonConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
JsonConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...
JsonConverter implements TypeConverter<T> { @Override public String toString(Type type, T value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } try { ObjectWriter objectWriter = objectMapper.writer(); return objectWriter.writeValueAsString(value); } ca...