-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
102 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
webserviceEnvironment=local | ||
baseUrl = http://localhost:9001 | ||
driver=chrome | ||
baseUrl = http://localhost:9001 | ||
driver=chrome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
acceptance-tests/src/test/resources/stories/earning_points/earning_points_from_flights.story
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
...-tests/src/test/resources/stories/earning_points/earning_points_from_special_offers.story
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dashboard.excluded.tag.list=story | ||
webservice.environment=dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...rvice/src/test/java/flyinghigh/services/flights/CalculatingEarnedPointsSpecification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package flyinghigh.services.flights; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.insightfullogic.lambdabehave.JunitSuiteRunner; | ||
import flyinghigh.services.flights.domain.Airport; | ||
import flyinghigh.services.flights.domain.Route; | ||
import flyinghigh.services.flights.repositories.RouteRepository; | ||
import flyinghigh.services.flights.services.points.PointsCalculator; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.util.List; | ||
|
||
import static com.insightfullogic.lambdabehave.Suite.describe; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
@RunWith(JunitSuiteRunner.class) | ||
public class CalculatingEarnedPointsSpecification { | ||
{ | ||
|
||
Airport sydney = new Airport("Australia", "Sydney", "SYD"); | ||
Airport melbourne = new Airport("Australia", "Melbourne", "MEL"); | ||
|
||
RouteRepository routeRepository = mock(RouteRepository.class); | ||
PointsCalculator pointsCalculator = new PointsCalculator(routeRepository); | ||
|
||
describe("calcuating points earned for a given route", it -> { | ||
|
||
it.uses(6000, 12000) | ||
.and(5000, 10000) | ||
.toShow("2 points should be earned per km travelled", | ||
(expect, distance, expectedPoints) -> { | ||
List<Route> routes = ImmutableList.of(Route.from(sydney) | ||
.to(melbourne) | ||
.withDistanceOf(distance).km()); | ||
when(routeRepository.findByDepartureCodeAndDestinationCode("SYD", "MEL")) | ||
.thenReturn(routes); | ||
|
||
int calculatedPoints | ||
= pointsCalculator.calculatePointsRequiredBetween("SYD", "MEL"); | ||
|
||
expect.that(calculatedPoints).isEqualTo(expectedPoints); | ||
}); | ||
}); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...web-service/src/test/java/flyinghigh/services/flights/CreatingAnAirportSpecification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package flyinghigh.services.flights; | ||
|
||
import flyinghigh.services.flights.domain.Airport; | ||
|
||
import com.insightfullogic.lambdabehave.JunitSuiteRunner; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.util.Stack; | ||
|
||
import static com.insightfullogic.lambdabehave.Suite.describe; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
@RunWith(JunitSuiteRunner.class) | ||
public class CreatingAnAirportSpecification {{ | ||
|
||
Airport airport = Airport.called("Sydney").inCountry("Australia").withCode("SYD"); | ||
|
||
describe("an airport", it -> { | ||
|
||
it.should("be created with the correct values", expect -> { | ||
expect.that(airport).hasProperty("name", equalTo("Sydney")); | ||
expect.that(airport).hasProperty("code", equalTo("SYD")); | ||
expect.that(airport).hasProperty("country", equalTo("Australia")); | ||
}); | ||
}); | ||
|
||
|
||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters