#297 Create unit tests for Gateway API pattern
This commit is contained in:
parent
88c3b04eb3
commit
3cbb88e09c
@ -0,0 +1,31 @@
|
|||||||
|
package com.iluwatar.api.gateway;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class ApiGatewayTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests getting the data for a desktop client
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetProductDesktop() {
|
||||||
|
ApiGateway apiGateway = new ApiGateway();
|
||||||
|
DesktopProduct desktopProduct = apiGateway.getProductDesktop();
|
||||||
|
|
||||||
|
assertEquals("20", desktopProduct.getPrice());
|
||||||
|
assertEquals("/product-image.png", desktopProduct.getImagePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests getting the data for a mobile client
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetProductMobile() {
|
||||||
|
ApiGateway apiGateway = new ApiGateway();
|
||||||
|
MobileProduct mobileProduct = apiGateway.getProductMobile();
|
||||||
|
|
||||||
|
assertEquals("20", mobileProduct.getPrice());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.iluwatar.api.gateway;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Application test
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AppTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() throws Exception {
|
||||||
|
String[] args = {};
|
||||||
|
App.main(args);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user