Skip to content

Commit 7db888f

Browse files
committed
feat(tiered-pricing): [outside-in] e2e fake-it
1 parent 68172c9 commit 7db888f

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import javax.servlet.http.HttpServletResponse;
1111

1212
@RestController
13-
public class ExampleGetController {
13+
public class SubscriptionTotalGetController {
1414

15-
@GetMapping("/")
16-
public ResponseEntity<String> response(@RequestParam String name, HttpServletResponse response) throws JSONException {
15+
@GetMapping("/subscription-total-price")
16+
public ResponseEntity<String> response(@RequestParam String subscriptions, HttpServletResponse response) throws JSONException {
1717
response.addHeader("content-type", "application/json");
1818

19-
return ResponseEntity.ok(new JSONObject().put("hello", name).toString());
19+
return ResponseEntity.ok(new JSONObject().put("total", 199).toString());
2020
}
2121
}

exercises/tiered_pricing/solutions/codely_outside-in/src/test/java/tv/codely/checkout/api/Controller/ExampleGetControllerShould.java

Lines changed: 0 additions & 16 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package tv.codely.checkout.api.Controller;
2+
3+
import org.json.JSONObject;
4+
import org.junit.jupiter.api.Test;
5+
import tv.codely.checkout.api.ApiTestCase;
6+
7+
public class SubscriptionTotalGetControllerShould extends ApiTestCase {
8+
9+
@Test
10+
public void calculate_total_subscription_price() throws Exception {
11+
whenGetRequestSentTo("/subscription-total-price?subscriptions=5");
12+
13+
JSONObject jsonResponse = new JSONObject().put("total", 199);
14+
assertSuccessJsonResponse(jsonResponse);
15+
}
16+
}

0 commit comments

Comments
 (0)