DefaultVariantProvider implements VariantProvider { public String nonce() { return String.valueOf(System.currentTimeMillis() + rdm.nextLong()); } DefaultVariantProvider(Random rdm); String timestamp(); String nonce();  }
@Test public void nonceShouldGetARandomNumber(){ long rdm = 10; when(mockRandom.nextLong()).thenReturn(rdm); long currentSeconds = System.currentTimeMillis() + rdm; long actual = valueOf(toTest.nonce()); assertTrue(currentSeconds == actual || (currentSeconds + 1) == actual); verify(mockRandom).nextLong(); }