@Test(groups = SMALL) public void testCorrectlyMapsAMysqlToAnEventWithAMapForOldAndNewEntities() { MysqlEventMapper mapper = new MysqlEventMapper(); MysqlEvent mysqlEvent = new MysqlEvent(1, "tableName", "INSERT", "{}", "{'key':'value'}", new Date()); Event<Map<String, Object>> genericEvent = mapper.mapToGenericEvent(mysqlEvent); assertEquals(genericEvent.getEventType(), mysqlEvent.getEventType()); assertEquals(genericEvent.getEntityName(), mysqlEvent.getEntityName()); assertEquals(genericEvent.getNewEntity().size(), 1); assertEquals(genericEvent.getOldEntity().size(), 0); }
Event<Map<String, Object>> mapToGenericEvent(MysqlEvent mysqlEvent) { Map<String, Object> oldEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getOldEntity()); Map<String, Object> newEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getNewEntity()); return new Event<>(mysqlEvent.getEventType(), mysqlEvent.getEntityName(), newEntity, oldEntity); }
MysqlEventMapper { Event<Map<String, Object>> mapToGenericEvent(MysqlEvent mysqlEvent) { Map<String, Object> oldEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getOldEntity()); Map<String, Object> newEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getNewEntity()); return new Event<>(mysqlEvent.getEventType(), mysqlEvent.getEntityName(), newEntity, oldEntity); } }
MysqlEventMapper { Event<Map<String, Object>> mapToGenericEvent(MysqlEvent mysqlEvent) { Map<String, Object> oldEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getOldEntity()); Map<String, Object> newEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getNewEntity()); return new Event<>(mysqlEvent.getEventType(), mysqlEvent.getEntityName(), newEntity, oldEntity); }  }
MysqlEventMapper { Event<Map<String, Object>> mapToGenericEvent(MysqlEvent mysqlEvent) { Map<String, Object> oldEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getOldEntity()); Map<String, Object> newEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getNewEntity()); return new Event<>(mysqlEvent.getEventType(), mysqlEvent.getEntityName(), newEntity, oldEntity); }   }
MysqlEventMapper { Event<Map<String, Object>> mapToGenericEvent(MysqlEvent mysqlEvent) { Map<String, Object> oldEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getOldEntity()); Map<String, Object> newEntity = JsonParserUtils.jsonStringToMap(mysqlEvent.getNewEntity()); return new Event<>(mysqlEvent.getEventType(), mysqlEvent.getEntityName(), newEntity, oldEntity); }    }