@Test public void testSuppressor() { String preparedStatement = "insert into ks1.t1 (k1, k2, k3) values (?, ?, ?)"; String expectedStatement = "insert into ks1.t1 (k1, k2, k3) values (?, ?, ?)[<ob1>, 'text2', <ob3>]"; List<ByteBuffer> values = createValues("text1", "text2", "text3"); ImmutableList<ColumnSpecification> columns = createTextColumns("col1", "col2", "col3"); when(mockOptions.hasColumnSpecifications()).thenReturn(true); when(mockOptions.getColumnSpecifications()).thenReturn(columns); when(mockOptions.getValues()).thenReturn(values); when(mockSuppressor.suppress(eq(columns.get(0)), eq(values.get(0)))).thenReturn(Optional.of("<ob1>")); when(mockSuppressor.suppress(eq(columns.get(1)), eq(values.get(1)))).thenReturn(Optional.empty()); when(mockSuppressor.suppress(eq(columns.get(2)), eq(values.get(2)))).thenReturn(Optional.of("<ob3>")); PreparedAuditOperation auditOperation = new PreparedAuditOperation(preparedStatement, mockOptions, mockSuppressor); assertThat(auditOperation.getOperationString()).isEqualTo(expectedStatement); }
@Override public String getOperationString() { if (effectiveStatement == null) { effectiveStatement = bindValues(); } return effectiveStatement; }
PreparedAuditOperation implements AuditOperation { @Override public String getOperationString() { if (effectiveStatement == null) { effectiveStatement = bindValues(); } return effectiveStatement; } }
PreparedAuditOperation implements AuditOperation { @Override public String getOperationString() { if (effectiveStatement == null) { effectiveStatement = bindValues(); } return effectiveStatement; } PreparedAuditOperation(String preparedStatement, QueryOptions options, BoundValueSuppressor boundValueSuppressor); }
PreparedAuditOperation implements AuditOperation { @Override public String getOperationString() { if (effectiveStatement == null) { effectiveStatement = bindValues(); } return effectiveStatement; } PreparedAuditOperation(String preparedStatement, QueryOptions options, BoundValueSuppressor boundValueSuppressor); @Override String getOperationString(); @Override String getNakedOperationString(); }
PreparedAuditOperation implements AuditOperation { @Override public String getOperationString() { if (effectiveStatement == null) { effectiveStatement = bindValues(); } return effectiveStatement; } PreparedAuditOperation(String preparedStatement, QueryOptions options, BoundValueSuppressor boundValueSuppressor); @Override String getOperationString(); @Override String getNakedOperationString();  }