@Test public void lifeCycle() { Game aGame = TestFixture.aGame(); aGame.dealInitialCards(); JsonPersistenceAssembler<Game> assembler = store.assembler(); JsonPersistenceObject<Game> persistenceGame = assembler.toPersistence(aGame); store.create(persistenceGame); JsonPersistenceObject<Game> retrievedPGame = store.find((PersistenceObjectId<GameID>) persistenceGame.id()); Game retrievedGame = assembler.toDomain(retrievedPGame); assertEquals(aGame.getID(), retrievedGame.getID()); }
@Override public void create(PersistenceObject<Player> po) { JsonPersistenceObject<Player> mpg = (JsonPersistenceObject<Player>) po; jsonMap.put((StringPersistenceId<PlayerID>) mpg.id(), mpg.getJson()); }