package org.craftedsw.tripservicekata.trip;\r
\r
-import static org.junit.Assert.assertThat;\r
import static org.hamcrest.core.Is.is;\r
+import static org.junit.Assert.assertThat;\r
\r
import java.util.List;\r
\r
import org.craftedsw.tripservicekata.exception.UserNotLoggedInException;\r
import org.craftedsw.tripservicekata.user.User;\r
+import org.junit.Before;\r
import org.junit.Test;\r
\r
public class TripServiceShould {\r
private static final User ANOTHER_USER = new User();\r
private static final Trip TO_BRAZIL = new Trip();\r
private User loggedInUser;\r
+ private TripService tripService;\r
+ \r
+ @Before\r
+ public void setUp() {\r
+ tripService = new TesteableTripService();\r
+ }\r
\r
@Test(expected=UserNotLoggedInException.class) public void\r
throw_an_exception_when_user_is_not_logged_in() {\r
- TripService tripService = new TesteableTripService();\r
- \r
loggedInUser = GUEST;\r
\r
tripService.getTripsByUser(UNUSED_USER);\r
}\r
\r
@Test public void\r
- not_return_any_trips_when_users_are_not_friends() {\r
- TesteableTripService tripService = new TesteableTripService();\r
- \r
+ not_return_any_trips_when_users_are_not_friends() { \r
loggedInUser = REGISTERED_USER;\r
\r
User friend = new User();\r