### Question:
AttributeTransformerChain implements AttributeTransformer { @Override public Map<String, AttributeValue> transform( final Parameters<?> parameters) { final ProxyParameters<?> proxy = new ProxyParameters(parameters); for (int i = 0; i < transformers.size(); ++i) { proxy.setAttributeValues(transformers.get(i).transform(proxy)); } return proxy.getAttributeValues(); } AttributeTransformerChain(
            final AttributeTransformer... transformers);  AttributeTransformerChain(
            final List<AttributeTransformer> transformers); List<AttributeTransformer> getTransformers(); @Override Map<String, AttributeValue> transform(
            final Parameters<?> parameters); @Override Map<String, AttributeValue> untransform(
            final Parameters<?> parameters); @Override String toString();  }### Answer:
@Test public void testTransformEmptyChain() { AttributeTransformer transformer = new AttributeTransformerChain( Collections.<AttributeTransformer> emptyList() ); Map<String, AttributeValue> values = EasyMock.createMock(Map.class); EasyMock.replay(values); Parameters<?> params = EasyMock.createMock(Parameters.class); EasyMock.expect(params.getAttributeValues()).andReturn(values); EasyMock.replay(params); Map<String, AttributeValue> result = transformer.transform(params); Assert.assertSame(values, result); }
@Test public void testTransform() { AttributeTransformer transformer1 = new TestTransformer(".one"); AttributeTransformer transformer2 = new TestTransformer(".two"); AttributeTransformer chain = new AttributeTransformerChain(transformer1, transformer2); Map<String, AttributeValue> values = new HashMap<String, AttributeValue>(); values.put("test1", new AttributeValue("foo")); values.put("test2", new AttributeValue("bar")); Parameters<?> params = EasyMock.createMock(Parameters.class); EasyMock.expect(params.getAttributeValues()).andReturn(values); EasyMock.replay(params); Map<String, AttributeValue> result = chain.transform(params); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); Assert.assertEquals("foo.one.two", result.get("test1").getS()); Assert.assertEquals("bar.one.two", result.get("test2").getS()); }