@Test public void testNextIdentifierShouldReturnAProperIdWhenThePreviousTimestampEqualsTheCurrent() { String expected = "20130624145212.0888"; Calendar cal = Calendar.getInstance(); cal.set(2013, 5, 24, 14, 52, 12); Date currentDate = cal.getTime(); given(currentDateProvider.getCurrentDate()).willReturn(currentDate); Whitebox.setInternalState(underTest, "previousSimpleDate", "20130624145212"); Whitebox.setInternalState(underTest, "currentNumber", new AtomicInteger(888)); String actual = underTest.nextIdentifier(); verify(currentDateProvider).getCurrentDate(); Assert.assertEquals(actual, expected); }
public synchronized String nextIdentifier() { String currentSimpleDate = getCurrentDateFormattedForFiles(); checkPreviousDate(currentSimpleDate); return currentSimpleDate + "." + fourDigitString(); }
TimeStampBasedIdGenerator { public synchronized String nextIdentifier() { String currentSimpleDate = getCurrentDateFormattedForFiles(); checkPreviousDate(currentSimpleDate); return currentSimpleDate + "." + fourDigitString(); } }
TimeStampBasedIdGenerator { public synchronized String nextIdentifier() { String currentSimpleDate = getCurrentDateFormattedForFiles(); checkPreviousDate(currentSimpleDate); return currentSimpleDate + "." + fourDigitString(); }  }
TimeStampBasedIdGenerator { public synchronized String nextIdentifier() { String currentSimpleDate = getCurrentDateFormattedForFiles(); checkPreviousDate(currentSimpleDate); return currentSimpleDate + "." + fourDigitString(); }  synchronized String nextIdentifier(); }
TimeStampBasedIdGenerator { public synchronized String nextIdentifier() { String currentSimpleDate = getCurrentDateFormattedForFiles(); checkPreviousDate(currentSimpleDate); return currentSimpleDate + "." + fourDigitString(); }  synchronized String nextIdentifier();  }