### Question:
MongoTicketRepository implements LotteryTicketRepository { public int getNextId() { Document find = new Document("_id", "ticketId"); Document increase = new Document("seq", 1); Document update = new Document("$inc", increase); Document result = countersCollection.findOneAndUpdate(find, update); return result.getInteger("seq"); } MongoTicketRepository();  MongoTicketRepository(String dbName, String ticketsCollectionName,
                               String countersCollectionName); void connect(); void connect(String dbName, String ticketsCollectionName,
                      String countersCollectionName); int getNextId(); MongoCollection<Document> getTicketsCollection(); MongoCollection<Document> getCountersCollection(); @Override Optional<LotteryTicket> findById(LotteryTicketId id); @Override Optional<LotteryTicketId> save(LotteryTicket ticket); @Override Map<LotteryTicketId, LotteryTicket> findAll(); @Override void deleteAll();  }### Answer:
@Test void testNextId() { assertEquals(1, repository.getNextId()); assertEquals(2, repository.getNextId()); assertEquals(3, repository.getNextId()); }