### Question:
JooqFightDAO extends AbstractJooqDAO implements FightDAO { @Override public void insert(Fight fight) { Preconditions.checkNotNull(fight, "fight"); LOGGER.debug("Inserting fight {}", fight); context() .insertInto(FIGHT, FIGHT.ID, FIGHT.ATTACKER_ID, FIGHT.DEFENDER_ID, FIGHT.PLANET_ID, FIGHT.ROUND, FIGHT.CRYSTALS_LOOTED, FIGHT.GAS_LOOTED) .values( fight.getId(), fight.getAttackerId(), fight.getDefenderId(), fight.getPlanetId(), fight.getRound(), fight.getLoot().getCrystals(), fight.getLoot().getGas() ) .execute(); insertShips(fight, fight.getAttackingShips(), Category.ATTACKER_SHIP); insertShips(fight, fight.getDefendingShips(), Category.DEFENDER_SHIP); insertShips(fight, fight.getRemainingAttackerShips(), Category.REMAINING_ATTACKER_SHIP); insertShips(fight, fight.getRemainingDefenderShips(), Category.REMAINING_DEFENDER_SHIP); } @Inject  JooqFightDAO(UnitOfWorkService unitOfWorkService); @Override Optional<FightWithPlanetAndPlayer> findWithId(UUID id); @Override void insert(Fight fight); @Override List<FightWithPlanetAndPlayer> findFightsWithPlayerSinceRound(UUID playerId, long round); static final Player ATTACKER_ALIAS; static final Player DEFENDER_ALIAS; }### Answer:
@Test public void testInsert() throws Exception { Fight fight = new Fight( UUID.fromString("df40ccf7-6fd8-4c13-8eef-7742a87a55b0"), BasicScenario.Player1.PLAYER.getId(), BasicScenario.Player2.PLAYER.getId(), BasicScenario.Player2.Planet1.PLANET.getId(), new Ships(new Ship(ShipType.MOSQUITO, 5), new Ship(ShipType.MULE, 1)), new Ships(new Ship(ShipType.DAEDALUS, 1)), new Ships(new Ship(ShipType.MOSQUITO, 1)), new Ships(new Ship(ShipType.DAEDALUS, 1)), 10, new Resources(10, 20, 0) ); sut.insert(fight); List<Map<String, Object>> fightRows = select("SELECT * FROM fight WHERE id = ?", fight.getId()); List<Map<String, Object>> fightShipsRows = select("SELECT * FROM fight_ships WHERE fight_id = ?", fight.getId()); assertThat(fightRows, hasSize(1)); verifyFightRow(fightRows.get(0), fight); assertThat(fightShipsRows, hasSize(5)); verifyFightShipsRows(fightShipsRows, fight); }