HibernateSequentialNumberCounterStore implements SequentialNumberCounterStore { @Override public void deleteCounter( String uid ) { sessionFactory.getCurrentSession().createQuery( "DELETE SequentialNumberCounter WHERE owneruid = :uid" ) .setParameter( "uid", uid ).executeUpdate(); } HibernateSequentialNumberCounterStore( SessionFactory sessionFactory ); @Override List<Integer> getNextValues( String uid, String key, int length ); @Override void deleteCounter( String uid );  }
@Test public void deleteCounter() { assertTrue( dummyService.getNextValues( "ABC", "ABC-#", 3 ).contains( 1 ) ); dummyService.deleteCounter( "ABC" ); assertTrue( dummyService.getNextValues( "ABC", "ABC-#", 3 ).contains( 1 ) ); assertTrue( dummyService.getNextValues( "ABC", "ABC-##", 3 ).contains( 1 ) ); assertTrue( dummyService.getNextValues( "ABC", "ABC-###", 3 ).contains( 1 ) ); dummyService.deleteCounter( "ABC" ); assertTrue( dummyService.getNextValues( "ABC", "ABC-#", 3 ).contains( 1 ) ); assertTrue( dummyService.getNextValues( "ABC", "ABC-##", 3 ).contains( 1 ) ); assertTrue( dummyService.getNextValues( "ABC", "ABC-###", 3 ).contains( 1 ) ); }