#297 Create unit tests for Gateway API pattern

This commit is contained in:
tmcconville 2016-02-07 17:05:45 -06:00
parent 88c3b04eb3
commit 3cbb88e09c
2 changed files with 48 additions and 0 deletions

View File

@ -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());
}
}

View File

@ -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);
}
}