### Question:
StringPassResolver extends BasePlugin implements Resolver { @Override public OneRow setFields(List<OneField> record) { OneField oneField = record.get(0); if ((oneField.val instanceof InputStream && resolveWriteCount > 0) || (oneField.val instanceof byte[] && ((byte[]) oneField.val).length == 0)) { return null; } oneRow.setData(oneField.val); resolveWriteCount++; return oneRow; }  @Override List<OneField> getFields(OneRow onerow); @Override OneRow setFields(List<OneField> record);  }### Answer:
@Test public void testSetFields() throws Exception { StringPassResolver resolver = buildResolver(); byte[] data = new byte[] { (int) 'a', (int) 'b', (int) 'c', (int) 'd', (int) '\n', (int) 'n', (int) 'o', (int) '\n' }; List<OneField> record = Collections.singletonList(new OneField(DataType.BYTEA.getOID(), Arrays.copyOfRange(data, 0, 5))); OneRow oneRow = resolver.setFields(record); verifyOneRow(oneRow, Arrays.copyOfRange(data, 0, 5)); record = Collections.singletonList(new OneField(DataType.BYTEA.getOID(), Arrays.copyOfRange(data, 5, 8))); oneRow = resolver.setFields(record); verifyOneRow(oneRow, Arrays.copyOfRange(data, 5, 8)); }
@Test public void testSetFieldsEmptyByteArray() throws Exception { StringPassResolver resolver = buildResolver(); byte[] empty = new byte[0]; List<OneField> record = Collections.singletonList(new OneField(DataType.BYTEA.getOID(), empty)); OneRow oneRow = resolver.setFields(record); assertNull(oneRow); }