### Question:
AttributeEncryptor implements AttributeTransformer { @Override public Map<String, AttributeValue> transform(final Parameters<?> parameters) { final ModelClassMetadata metadata = getModelClassMetadata(parameters); final Map<String, AttributeValue> attributeValues = parameters.getAttributeValues(); if (metadata.doNotTouch) { return attributeValues; } if (parameters.isPartialUpdate()) { throw new DynamoDBMappingException( "Use of AttributeEncryptor without SaveBehavior.PUT or SaveBehavior.CLOBBER is an error " + "and can result in data-corruption. This occured while trying to save " + parameters.getModelClass()); } try { return encryptor.encryptRecord( attributeValues, metadata.getEncryptionFlags(), paramsToContext(parameters)); } catch (Exception ex) { throw new DynamoDBMappingException(ex); } } AttributeEncryptor(final DynamoDBEncryptor encryptor);  AttributeEncryptor(final EncryptionMaterialsProvider encryptionMaterialsProvider); DynamoDBEncryptor getEncryptor(); @Override Map<String, AttributeValue> transform(final Parameters<?> parameters); @Override Map<String, AttributeValue> untransform(final Parameters<?> parameters);  }### Answer:
@Test public void testUnaffected() { Parameters<Untouched> params = FakeParameters.getInstance(Untouched.class, attribs, null, TABLE_NAME, HASH_KEY, RANGE_KEY); Map<String, AttributeValue> encryptedAttributes = encryptor.transform(params); assertEquals(attribs, encryptedAttributes); }
@Test(expectedExceptions = DynamoDBMappingException.class) public void rejectsPartialUpdate() { Parameters<BaseClass> params = FakeParameters.getInstance(BaseClass.class, attribs, null, TABLE_NAME, HASH_KEY, RANGE_KEY, true); encryptor.transform(params); }