From: Gustavo Martin Morcuende Date: Thu, 24 Nov 2016 23:18:35 +0000 (+0100) Subject: Inline isFriendsWith(user) X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=d0632521080d97d034dbc2a47b8c7c98d1a3cdf2;p=JavaForFun Inline isFriendsWith(user) --- diff --git a/TDD/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java b/TDD/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java index 4eddb9e..57d1f42 100644 --- a/TDD/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java +++ b/TDD/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java @@ -16,7 +16,6 @@ public class TripService { // User loggedUser = UserSession.getInstance().getLoggedUser(); User loggedInUser = getLoggedInUser(); if (loggedInUser != null) { - boolean isFriend = user.isFriendsWith(loggedInUser); // The deepest branch. For refactoring legacy code we must begin from the // deepest branch. This is just the opposite for creating the unit test // for our legacy code. @@ -26,7 +25,7 @@ public class TripService { // to shortest branch. Modifications in the legacy code may be hand made. // In this case we can not do anything with this code (this is the deepest branch) // so we will have to start with the for loop (which is the second deepest branch) - if (isFriend) { + if (user.isFriendsWith(loggedInUser)) { tripList = tripsBy(user); } return tripList;