Java 11 migration: patterns starting with a (#1084)
* Moves abstract-factory pattern to java 11 * Moves abstract-document pattern to java 11 * Moves acyclic-visitor pattern to java 11 * Moves adapter pattern to java 11 * Moves aggregator-microservices pattern to java 11 * Moves api-gateway pattern to java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
3c57bf7078
commit
f04fc3c0dc
@ -23,15 +23,15 @@
|
||||
|
||||
package com.iluwatar.api.gateway;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Test API Gateway Pattern
|
||||
*/
|
||||
@ -56,12 +56,12 @@ public class ApiGatewayTest {
|
||||
*/
|
||||
@Test
|
||||
public void testGetProductDesktop() {
|
||||
String imagePath = "/product-image.png";
|
||||
String price = "20";
|
||||
var imagePath = "/product-image.png";
|
||||
var price = "20";
|
||||
when(imageClient.getImagePath()).thenReturn(imagePath);
|
||||
when(priceClient.getPrice()).thenReturn(price);
|
||||
|
||||
DesktopProduct desktopProduct = apiGateway.getProductDesktop();
|
||||
var desktopProduct = apiGateway.getProductDesktop();
|
||||
|
||||
assertEquals(price, desktopProduct.getPrice());
|
||||
assertEquals(imagePath, desktopProduct.getImagePath());
|
||||
@ -72,10 +72,10 @@ public class ApiGatewayTest {
|
||||
*/
|
||||
@Test
|
||||
public void testGetProductMobile() {
|
||||
String price = "20";
|
||||
var price = "20";
|
||||
when(priceClient.getPrice()).thenReturn(price);
|
||||
|
||||
MobileProduct mobileProduct = apiGateway.getProductMobile();
|
||||
var mobileProduct = apiGateway.getProductMobile();
|
||||
|
||||
assertEquals(price, mobileProduct.getPrice());
|
||||
}
|
||||
|
Reference in New Issue
Block a user