@Test(expected = RuntimeException.class) public void testTransformTupleWithNoFieldName() { SingleFieldResultTransformer sut = new SingleFieldResultTransformer(); sut.transformTuple(new Object[] {}, new String[] {}); }
@Override public Object transformTuple(final Object[] tuple, final String[] aliases) { if (fieldName == null) { throw new RuntimeException("fieldName is null"); } log.trace("Transforming tuple - looking for field '" + fieldName + "'"); for (int i = 0; i < aliases.length; i++) { if (aliases[i].toLowerCase().equals(fieldName.toLowerCase())) { if (log.isTraceEnabled()) { if (tuple[i] != null) { log.trace("Found the correct field '" + fieldName + "', value: " + tuple[i] + "'"); } else { log.trace("Found the correct field '" + fieldName + "', and it's null"); } } return tuple[i]; } log.trace("Skipping field '" + aliases[i] + "'"); } log.trace("Couldn't find the correct field '" + fieldName + "'"); return null; }
SingleFieldResultTransformer implements ResultTransformer { @Override public Object transformTuple(final Object[] tuple, final String[] aliases) { if (fieldName == null) { throw new RuntimeException("fieldName is null"); } log.trace("Transforming tuple - looking for field '" + fieldName + "'"); for (int i = 0; i < aliases.length; i++) { if (aliases[i].toLowerCase().equals(fieldName.toLowerCase())) { if (log.isTraceEnabled()) { if (tuple[i] != null) { log.trace("Found the correct field '" + fieldName + "', value: " + tuple[i] + "'"); } else { log.trace("Found the correct field '" + fieldName + "', and it's null"); } } return tuple[i]; } log.trace("Skipping field '" + aliases[i] + "'"); } log.trace("Couldn't find the correct field '" + fieldName + "'"); return null; } }
SingleFieldResultTransformer implements ResultTransformer { @Override public Object transformTuple(final Object[] tuple, final String[] aliases) { if (fieldName == null) { throw new RuntimeException("fieldName is null"); } log.trace("Transforming tuple - looking for field '" + fieldName + "'"); for (int i = 0; i < aliases.length; i++) { if (aliases[i].toLowerCase().equals(fieldName.toLowerCase())) { if (log.isTraceEnabled()) { if (tuple[i] != null) { log.trace("Found the correct field '" + fieldName + "', value: " + tuple[i] + "'"); } else { log.trace("Found the correct field '" + fieldName + "', and it's null"); } } return tuple[i]; } log.trace("Skipping field '" + aliases[i] + "'"); } log.trace("Couldn't find the correct field '" + fieldName + "'"); return null; }  }
SingleFieldResultTransformer implements ResultTransformer { @Override public Object transformTuple(final Object[] tuple, final String[] aliases) { if (fieldName == null) { throw new RuntimeException("fieldName is null"); } log.trace("Transforming tuple - looking for field '" + fieldName + "'"); for (int i = 0; i < aliases.length; i++) { if (aliases[i].toLowerCase().equals(fieldName.toLowerCase())) { if (log.isTraceEnabled()) { if (tuple[i] != null) { log.trace("Found the correct field '" + fieldName + "', value: " + tuple[i] + "'"); } else { log.trace("Found the correct field '" + fieldName + "', and it's null"); } } return tuple[i]; } log.trace("Skipping field '" + aliases[i] + "'"); } log.trace("Couldn't find the correct field '" + fieldName + "'"); return null; }  @SuppressWarnings("unchecked") @Override List transformList(final List collection); @Override Object transformTuple(final Object[] tuple, final String[] aliases); void setFieldName(final String inFieldName); }
SingleFieldResultTransformer implements ResultTransformer { @Override public Object transformTuple(final Object[] tuple, final String[] aliases) { if (fieldName == null) { throw new RuntimeException("fieldName is null"); } log.trace("Transforming tuple - looking for field '" + fieldName + "'"); for (int i = 0; i < aliases.length; i++) { if (aliases[i].toLowerCase().equals(fieldName.toLowerCase())) { if (log.isTraceEnabled()) { if (tuple[i] != null) { log.trace("Found the correct field '" + fieldName + "', value: " + tuple[i] + "'"); } else { log.trace("Found the correct field '" + fieldName + "', and it's null"); } } return tuple[i]; } log.trace("Skipping field '" + aliases[i] + "'"); } log.trace("Couldn't find the correct field '" + fieldName + "'"); return null; }  @SuppressWarnings("unchecked") @Override List transformList(final List collection); @Override Object transformTuple(final Object[] tuple, final String[] aliases); void setFieldName(final String inFieldName);  }