@Test public void testGetValue_PrimaryIllegalArg() { when(primary.getValue(row)).thenThrow(new IllegalArgumentException()); when(fallback.getValue(row)).thenReturn(FALLBACK_VAL); assertEquals(FALLBACK_VAL, instance.getValue(row)); verify(fallbackIf, never()).matches(any()); }
@Override public T getValue(final Row row) { T value; try { value = primaryColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } if (condition.matches(value)) { try { value = fallbackColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } } return value; }
FallbackColumnValue extends AbstractColumnValue<T> { @Override public T getValue(final Row row) { T value; try { value = primaryColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } if (condition.matches(value)) { try { value = fallbackColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } } return value; } }
FallbackColumnValue extends AbstractColumnValue<T> { @Override public T getValue(final Row row) { T value; try { value = primaryColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } if (condition.matches(value)) { try { value = fallbackColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } } return value; } @JsonCreator @SuppressWarnings("unchecked")  FallbackColumnValue(@JsonProperty("primaryColumn") final ColumnValue<T> primary,
                               @JsonProperty("fallbackColumn") final ColumnValue<T> fallback,
                               @JsonProperty("fallbackIf") final MappingPredicate<T> fallIf,
                               @JsonProperty(value="multiKey", required=false) final String multiKey); }
FallbackColumnValue extends AbstractColumnValue<T> { @Override public T getValue(final Row row) { T value; try { value = primaryColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } if (condition.matches(value)) { try { value = fallbackColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } } return value; } @JsonCreator @SuppressWarnings("unchecked")  FallbackColumnValue(@JsonProperty("primaryColumn") final ColumnValue<T> primary,
                               @JsonProperty("fallbackColumn") final ColumnValue<T> fallback,
                               @JsonProperty("fallbackIf") final MappingPredicate<T> fallIf,
                               @JsonProperty(value="multiKey", required=false) final String multiKey); @JsonProperty("primaryColumn") final ColumnValue<T> getPrimaryColumn(); @JsonProperty("fallbackColumn") final ColumnValue<T> getFallbackColumn(); @JsonProperty("fallbackIf") MappingPredicate<T> getFallbackIf(); @Override int getSortColumn(); @Override T getValue(final Row row); }
FallbackColumnValue extends AbstractColumnValue<T> { @Override public T getValue(final Row row) { T value; try { value = primaryColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } if (condition.matches(value)) { try { value = fallbackColumn.getValue(row); } catch (IllegalArgumentException iae) { value = null; } } return value; } @JsonCreator @SuppressWarnings("unchecked")  FallbackColumnValue(@JsonProperty("primaryColumn") final ColumnValue<T> primary,
                               @JsonProperty("fallbackColumn") final ColumnValue<T> fallback,
                               @JsonProperty("fallbackIf") final MappingPredicate<T> fallIf,
                               @JsonProperty(value="multiKey", required=false) final String multiKey); @JsonProperty("primaryColumn") final ColumnValue<T> getPrimaryColumn(); @JsonProperty("fallbackColumn") final ColumnValue<T> getFallbackColumn(); @JsonProperty("fallbackIf") MappingPredicate<T> getFallbackIf(); @Override int getSortColumn(); @Override T getValue(final Row row);  }