예제 #1
0
  @Test
  public void not_return_any_trips_when_users_are_not_friends() {
    User friend = UserBuilder.aUser().friendsWith(ANOTHER_USER).withTrips(TO_BRAZIL).build();

    List<Trip> friendTrips = tripService.getTripsByUser(friend, REGISTERED_USER);
    // You must always begin writing the assert.
    // Remember: the assert must match the unit test method's name!!
    // In this case, no trips must be returned.
    assertThat(friendTrips.size(), is(0));
  }
예제 #2
0
 @Test(expected = UserNotLoggedInException.class)
 public void throw_an_exception_when_user_is_not_logged_in() {
   tripService.getTripsByUser(UNUSED_USER, GUEST);
 }