### Question:
ContainsPredicate extends OperationPredicate { @Override public Map<String, Object> toMap() { return Collections.singletonMap(NAME, new ArrayList<>(Arrays.asList(getContextKey(), value))); } ContainsPredicate(ContextTransformer transformer, String value); static ContainsPredicate fromMap(Map<String, Object> map); String getValue(); @Override Map<String, Object> toMap(); @Override int hashCode(); @Override boolean equals(Object obj); static final String NAME; }### Answer:
@Test public void testToMap() { ContextTransformer transformer = createStrictMock(ContextTransformer.class); expect(transformer.getKey()).andReturn("data").times(1); replayAll(); ContainsPredicate predicate = new ContainsPredicate(transformer, "ONE"); Map<String, Object> actualMap = predicate.toMap(); verifyAll(); Map<String, Object> expectedMap = new HashMap<>(); expectedMap.put("contains", new ArrayList<>(Arrays.asList("data", "ONE"))); Assert.assertEquals(expectedMap, actualMap); }