Пример #1
0
 @Test
 public void returnedStringDateShouldBeInRange() throws ParseException {
   dateStringRandomizer = new DateStringRandomizer(today, tomorrow);
   Date actual = convertToDate(dateStringRandomizer.getRandomValue(), DEFAULT_DATE_FORMAT);
   assertThat(actual).isNotNull();
   assertThat(today.compareTo(actual) * tomorrow.compareTo(actual)).isGreaterThan(0);
 }
Пример #2
0
 @Test
 public void returnedStringDateShouldHaveSpecifiedFormat() throws Exception {
   dateStringRandomizer = new DateStringRandomizer(DATE_FORMAT, today, tomorrow);
   String randomDate = dateStringRandomizer.getRandomValue();
   assertThat(randomDate).isNotNull();
   assertThat(randomDate).matches("\\d{4}-\\d{2}-\\d{2}");
 }
Пример #3
0
 @Test
 public void returnedStringShouldBeDate() {
   dateStringRandomizer = new DateStringRandomizer();
   String randomDate = dateStringRandomizer.getRandomValue();
   assertThat(randomDate).isNotNull();
   try {
     convertToDate(randomDate, DEFAULT_DATE_FORMAT);
   } catch (ParseException e) {
     Assert.fail("Returned date doesn't have a proper format " + randomDate);
   }
 }