@Test public void testCreateEncryptionContextTableNameOverride_expectedOverride() { Function<EncryptionContext, EncryptionContext> myNewTableName = overrideEncryptionContextTableName("OriginalTableName", "MyNewTableName"); EncryptionContext context = EncryptionContext.builder().tableName("OriginalTableName").build(); EncryptionContext newContext = myNewTableName.apply(context); assertEquals("OriginalTableName", context.getTableName()); assertEquals("MyNewTableName", newContext.getTableName()); }
static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName( String originalTableName, String newTableName) { return encryptionContext -> { if (encryptionContext == null || encryptionContext.getTableName() == null || originalTableName == null || newTableName == null) { return encryptionContext; } if (originalTableName.equals(encryptionContext.getTableName())) { return encryptionContext.toBuilder().tableName(newTableName).build(); } else { return encryptionContext; } }; }
EncryptionContextOperators { static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName( String originalTableName, String newTableName) { return encryptionContext -> { if (encryptionContext == null || encryptionContext.getTableName() == null || originalTableName == null || newTableName == null) { return encryptionContext; } if (originalTableName.equals(encryptionContext.getTableName())) { return encryptionContext.toBuilder().tableName(newTableName).build(); } else { return encryptionContext; } }; } }
EncryptionContextOperators { static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName( String originalTableName, String newTableName) { return encryptionContext -> { if (encryptionContext == null || encryptionContext.getTableName() == null || originalTableName == null || newTableName == null) { return encryptionContext; } if (originalTableName.equals(encryptionContext.getTableName())) { return encryptionContext.toBuilder().tableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators(); }
EncryptionContextOperators { static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName( String originalTableName, String newTableName) { return encryptionContext -> { if (encryptionContext == null || encryptionContext.getTableName() == null || originalTableName == null || newTableName == null) { return encryptionContext; } if (originalTableName.equals(encryptionContext.getTableName())) { return encryptionContext.toBuilder().tableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators();  }
EncryptionContextOperators { static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName( String originalTableName, String newTableName) { return encryptionContext -> { if (encryptionContext == null || encryptionContext.getTableName() == null || originalTableName == null || newTableName == null) { return encryptionContext; } if (originalTableName.equals(encryptionContext.getTableName())) { return encryptionContext.toBuilder().tableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators();   }