Skip to content

Commit f2ae0fc

Browse files
committed
mods
1 parent 6e90084 commit f2ae0fc

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

trip-management/pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@
7171
<version>3.5.21</version>
7272
<configuration>
7373
<pactBrokerUrl>http://192.168.99.100:9080</pactBrokerUrl>
74-
<serviceProviders>
75-
<serviceProvider>
76-
<name>passengerManagementProvider</name>
77-
<protocol>http</protocol>
78-
<host>localhost</host>
79-
<port>50925</port>
80-
<pactFileDirectory>target/pacts</pactFileDirectory>
81-
</serviceProvider>
82-
</serviceProviders>
74+
<!--<serviceProviders>-->
75+
<!--<serviceProvider>-->
76+
<!--<name>passengerManagementProvider</name>-->
77+
<!--<protocol>http</protocol>-->
78+
<!--<host>localhost</host>-->
79+
<!--<port>50925</port>-->
80+
<!--<pactFileDirectory>target/pacts</pactFileDirectory>-->
81+
<!--</serviceProvider>-->
82+
<!--</serviceProviders>-->
8383
</configuration>
8484
</plugin>
8585
<plugin>

trip-management/src/main/java/pl/piomin/services/trip/model/Passenger.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public class Passenger {
55
private Long id;
66
private String name;
77
private String phoneNo;
8+
private String login;
89
private int balance;
910
private int homeLocationX;
1011
private int homeLocationY;
@@ -75,4 +76,11 @@ public void setDiscount(int discount) {
7576
this.discount = discount;
7677
}
7778

79+
public String getLogin() {
80+
return login;
81+
}
82+
83+
public void setLogin(String login) {
84+
this.login = login;
85+
}
7886
}

trip-management/src/test/java/pl/piomin/services/trip/TripDiffIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TripDiffIntegrationTests {
4949
hoverflyRule = HoverflyRule.inDiffMode(SimulationSource.dsl(
5050
HoverflyDsl.service(HoverflyMatchers.startsWith(InetAddress.getLocalHost().getHostName()))
5151
.get(HoverflyMatchers.startsWith("/passengers/"))
52-
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'John Smith'}")).header("Content-Type", "application/json;charset=UTF-8")),
52+
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'John Smith','login':'{{ Request.Path.[2] }}'}")).header("Content-Type", "application/json;charset=UTF-8")),
5353
HoverflyDsl.service(HoverflyMatchers.startsWith(InetAddress.getLocalHost().getHostName()))
5454
.get(HoverflyMatchers.startsWith("/drivers/"))
5555
.willReturn(ResponseCreators.success(HttpBodyConverter.jsonWithSingleQuotes("{'id':1,'name':'David Smith','currentLocationX': 15,'currentLocationY':25}")))

trip-management/src/test/java/pl/piomin/services/trip/TripHoverflyIntegrationTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package pl.piomin.services.trip;
22

3+
import io.specto.hoverfly.junit.core.SimulationSource;
34
import io.specto.hoverfly.junit.rule.HoverflyRule;
45
import org.junit.ClassRule;
56
import org.junit.Test;
@@ -12,6 +13,8 @@
1213
import pl.piomin.services.trip.client.PassengerManagementClient;
1314
import pl.piomin.services.trip.model.Passenger;
1415

16+
import java.nio.file.Paths;
17+
1518
@SpringBootTest(properties = "eureka.client.registerWithEureka=false")
1619
@RunWith(SpringRunner.class)
1720
public class TripHoverflyIntegrationTests {
@@ -22,13 +25,18 @@ public class TripHoverflyIntegrationTests {
2225
@ClassRule
2326
public static HoverflyRule hoverflyRule = HoverflyRule
2427
.inCaptureOrSimulationMode("passenger-management.json")
28+
// .inSpyMode(SimulationSource.file(Paths.get("src/test/resources/hoverfly","passenger-management.json")))
2529
.printSimulationData();
2630

2731
@Test
2832
public void testGetPassengerByLogin() {
29-
Passenger passenger = passengerManagementClient.getPassenger("walker");
33+
final String login = "walker2";
34+
Passenger passenger = passengerManagementClient.getPassenger(login);
3035
Assert.notNull(passenger, "No passenger");
36+
Assert.notNull(passenger.getId(), "No passenger id");
3137
Assert.notNull(passenger.getName(), "No passenger name");
38+
Assert.notNull(passenger.getLogin(), "No passenger login");
39+
Assert.isTrue(passenger.getLogin().equals(login), "Invalid passenger login");
3240
}
3341

3442
}

0 commit comments

Comments
 (0)