### Question:
OrderIdProviderImpl implements OrderIdProvider { @Override public Long nextVal() { Query query = query(where("id").is(ORDER_SEQUENCE_ID)); mongoOperations.upsert(query, update("id", ORDER_SEQUENCE_ID).inc("nextVal", 1), OrderSequence.class); return mongoOperations.findOne(query, OrderSequence.class).getNextVal(); } @Autowired  OrderIdProviderImpl(@Qualifier("mongoTemplate") MongoOperations mongoOperations); @Override Long nextVal(); @PostConstruct void init(); static final String ORDER_SEQUENCE_ID; }### Answer:
@Test public void testNextVal() throws Exception { Long orderId = orderIdProvider.nextVal(); Long nextOrderId = orderIdProvider.nextVal(); Long expected = orderId + 1; assertEquals(expected , nextOrderId); }