Esempio n. 1
0
  public void assertErrorMessageForEmptyEmail() {
    SoftAssertions softAssertions = new SoftAssertions();
    String sText = emptyEmailIDError.getText();
    // System.out.println(sText);
    softAssertions.assertThat(sText);

    softAssertions.assertAll();
  }
Esempio n. 2
0
  @Test
  public void drivers_should_have_right_points() {
    SoftAssertions softly = new SoftAssertions();

    softly.assertThat(race.getPoints(winner)).isEqualTo(25);
    softly.assertThat(race.getPoints(second)).isEqualTo(18);
    softly.assertThat(race.getPoints(third)).isEqualTo(15);

    softly.assertAll();
  }
Esempio n. 3
0
  @Test
  public void drivers_should_have_right_positions() {
    SoftAssertions softly = new SoftAssertions();

    softly.assertThat(race.position(winner)).isEqualTo(0);
    softly.assertThat(race.position(second)).isEqualTo(1);
    softly.assertThat(race.position(third)).isEqualTo(2);

    softly.assertAll();
  }
 private void assertNotFound(
     JEReplicaDB replicaDB, final CSN startCSN, final PositionStrategy positionStrategy)
     throws ChangelogException {
   DBCursor<UpdateMsg> cursor =
       replicaDB.generateCursorFrom(startCSN, GREATER_THAN_OR_EQUAL_TO_KEY, positionStrategy);
   try {
     final SoftAssertions softly = new SoftAssertions();
     softly.assertThat(cursor.next()).isFalse();
     softly.assertThat(cursor.getRecord()).isNull();
     softly.assertAll();
   } finally {
     close(cursor);
   }
 }
  private void assertUsers(
      UserGroupCallback userGroupCallback,
      boolean john,
      boolean mary,
      boolean peter,
      boolean mike) {
    Assertions.assertThat(userGroupCallback).isNotNull();

    SoftAssertions assertions = new SoftAssertions();
    assertions.assertThat(userGroupCallback.existsUser("john")).as("john").isEqualTo(john);
    assertions.assertThat(userGroupCallback.existsUser("mary")).as("mary").isEqualTo(mary);
    assertions.assertThat(userGroupCallback.existsUser("peter")).as("peter").isEqualTo(peter);
    assertions.assertThat(userGroupCallback.existsUser("mike")).as("mike").isEqualTo(mike);
    assertions.assertAll();
  }
  private void assertFoundInOrder(
      JEReplicaDB replicaDB, final PositionStrategy positionStrategy, CSN... csns)
      throws ChangelogException {
    DBCursor<UpdateMsg> cursor =
        replicaDB.generateCursorFrom(csns[0], GREATER_THAN_OR_EQUAL_TO_KEY, positionStrategy);
    try {
      assertNull(cursor.getRecord(), "Cursor should point to a null record initially");

      for (int i = positionStrategy == ON_MATCHING_KEY ? 0 : 1; i < csns.length; i++) {
        final String msg = "i=" + i + ", csns[i]=" + csns[i].toStringUI();
        final SoftAssertions softly = new SoftAssertions();
        softly.assertThat(cursor.next()).as(msg).isTrue();
        softly.assertThat(cursor.getRecord().getCSN()).as(msg).isEqualTo(csns[i]);
        softly.assertAll();
      }
      final SoftAssertions softly = new SoftAssertions();
      softly.assertThat(cursor.next()).isFalse();
      softly.assertThat(cursor.getRecord()).isNull();
      softly.assertAll();
    } finally {
      close(cursor);
    }
  }
  private void assertGroups(
      UserGroupCallback userGroupCallback,
      boolean manager,
      boolean user,
      boolean analyst,
      boolean developer) {
    Assertions.assertThat(userGroupCallback).isNotNull();

    SoftAssertions assertions = new SoftAssertions();
    assertions
        .assertThat(userGroupCallback.existsGroup("manager"))
        .as("manager")
        .isEqualTo(manager);
    assertions.assertThat(userGroupCallback.existsGroup("user")).as("user").isEqualTo(user);
    assertions
        .assertThat(userGroupCallback.existsGroup("analyst"))
        .as("analyst")
        .isEqualTo(analyst);
    assertions
        .assertThat(userGroupCallback.existsGroup("developer"))
        .as("developer")
        .isEqualTo(developer);
    assertions.assertAll();
  }
 private void assertThatCursorIsExhausted(DBCursor<UpdateMsg> cursor) throws Exception {
   final SoftAssertions softly = new SoftAssertions();
   softly.assertThat(cursor.next()).isFalse();
   softly.assertThat(cursor.getRecord()).isNull();
   softly.assertAll();
 }