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