Java tutorial
/* * Copyright 2012-2015 Crown Equipment Corporation. All rights reserved. * See license distributed with this file. */ package com.crown.passthrough.controller.test; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.net.URI; import java.net.URISyntaxException; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; import com.crown.passthrough.web.response.BranchResponse; import com.crown.passthrough.web.response.CheckListResponse; import com.crown.passthrough.web.response.CustomerResponse; import com.crown.passthrough.web.response.EquipmentResponse; import com.crown.passthrough.web.response.FolderResponse; import com.crown.passthrough.web.response.InventoryResponse; import com.crown.passthrough.web.response.LaborCodeResponse; import com.crown.passthrough.web.response.LaborTimeTypeResponse; import com.crown.passthrough.web.response.ManufacturerResponse; import com.crown.passthrough.web.response.PmScheduleResponse; import com.crown.passthrough.web.response.RoleResponse; import com.crown.passthrough.web.response.ServiceQuoteResponse; import com.crown.passthrough.web.response.ServiceTruckResponse; import com.crown.passthrough.web.response.StandardJobCodeManufacturerResponse; import com.crown.passthrough.web.response.StandardJobCodeResponse; import com.crown.passthrough.web.response.StockAreaResponse; import com.crown.passthrough.web.response.TechnicianClockingResponse; import com.crown.passthrough.web.response.WebUserResponse; import com.crown.passthrough.web.response.WorkOrderResponse; /** * @author tbastres (Sogeti USA LLC) * @author Sogeti * * @version 1.0.0, created Oct 12, 2015 * @since 1.0.0 */ public class PassthroughControllerTest { private RestTemplate restTemplate; private String uRIPrefix; /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { } /** * This class implementation handles processing the... * */ /** * @throws java.lang.Exception */ @AfterClass public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { this.restTemplate = new RestTemplate(); this.restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); this.uRIPrefix = "http://Localhost:8080/PassThrough"; } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { this.restTemplate = null; } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#PassthroughController()}. */ @Test public void testPassthroughController() { fail("Not yet implemented"); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passCustomer(com.crown.common.model.Customer)}. * @throws URISyntaxException */ @Test public void testPassCustomer() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/customer"); CustomerResponse customer = restTemplate.getForObject(uri, CustomerResponse.class); assertNotNull("The rest call for customer returned null.", customer); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passEquipment(com.crown.common.model.Equipment)}. * @throws URISyntaxException */ @Test public void testPassEquipment() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/equipment"); EquipmentResponse equipment = restTemplate.getForObject(uri, EquipmentResponse.class); assertNotNull("The rest call for equipment returned null.", equipment); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passListInventory()}. * @throws URISyntaxException */ @Test public void testPassListInventory() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/inventory/listFull"); InventoryResponse inventory = restTemplate.getForObject(uri, InventoryResponse.class); assertNotNull("The rest call for inventory returned null.", inventory); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#pass()}. */ @Test public void testPass() { fail("Not yet implemented"); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passStandardJobCode()}. */ @Test public void testPassStandardJobCode() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/standardJobCode"); StandardJobCodeResponse standardJobCode = restTemplate.getForObject(uri, StandardJobCodeResponse.class); assertNotNull("The rest call for standard job code returned null.", standardJobCode); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passStockArea()}. */ @Test public void testPassStockArea() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/stockArea"); StockAreaResponse stockArea = restTemplate.getForObject(uri, StockAreaResponse.class); assertNotNull("The rest call for stock area returned null.", stockArea); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passListChecklist()}. */ @Test public void testPassListChecklist() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/checklist/list"); CheckListResponse checkList = restTemplate.getForObject(uri, CheckListResponse.class); assertNotNull("The rest call for check list returned null.", checkList); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passListChecklistResults()}. */ @Test public void testPassListChecklistResults() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/checklist/listAcceptedResults"); CheckListResponse checkListResult = restTemplate.getForObject(uri, CheckListResponse.class); assertNotNull("The rest call for check list results returned null.", checkListResult); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passBranch()}. */ @Test public void testPassBranch() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/branch"); BranchResponse branch = restTemplate.getForObject(uri, BranchResponse.class); assertNotNull("The rest call for branch returned null.", branch); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passFolder()}. */ @Test public void testPassFolder() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/folder"); FolderResponse folder = restTemplate.getForObject(uri, FolderResponse.class); assertNotNull("The rest call for folder returned null.", folder); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passListTechnichianClocking()}. */ @Test public void testPassListTechnichianClocking() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/technicianClocking/list"); TechnicianClockingResponse technicianClocking = restTemplate.getForObject(uri, TechnicianClockingResponse.class); assertNotNull("The rest call for technician clocking returned null.", technicianClocking); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passLaborCode()}. */ @Test public void testPassLaborCode() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/laborCode"); LaborCodeResponse laborCode = restTemplate.getForObject(uri, LaborCodeResponse.class); assertNotNull("The rest call for labor code returned null.", laborCode); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passLaborTimeType()}. */ @Test public void testPassLaborTimeType() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/laborTimeType"); LaborTimeTypeResponse laborTimeType = restTemplate.getForObject(uri, LaborTimeTypeResponse.class); assertNotNull("The rest call for labor time type returned null.", laborTimeType); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passManufacturer()}. */ @Test public void testPassManufacturer() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/manufacturer"); ManufacturerResponse manufacturer = restTemplate.getForObject(uri, ManufacturerResponse.class); assertNotNull("The rest call for manufacturer returned null.", manufacturer); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passPmSchedule()}. */ @Test public void testPassPmSchedule() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/pmSchedule"); PmScheduleResponse pmSchedule = restTemplate.getForObject(uri, PmScheduleResponse.class); assertNotNull("The rest call for pm schedule returned null.", pmSchedule); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passRole()}. */ @Test public void testPassRole() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/role"); RoleResponse role = restTemplate.getForObject(uri, RoleResponse.class); assertNotNull("The rest call for role returned null.", role); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passServiceQuote()}. */ @Test public void testPassServiceQuote() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/serviceQuote"); ServiceQuoteResponse serviceQuote = restTemplate.getForObject(uri, ServiceQuoteResponse.class); assertNotNull("The rest call for service quote returned null.", serviceQuote); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passServiceTruck()}. */ @Test public void testPassServiceTruck() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/serviceTruck"); ServiceTruckResponse serviceTruck = restTemplate.getForObject(uri, ServiceTruckResponse.class); assertNotNull("The rest call for service truck returned null.", serviceTruck); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passStandardJobCodeManufacturer()}. */ @Test public void testPassStandardJobCodeManufacturer() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/standardJobCodeManufacturer"); StandardJobCodeManufacturerResponse standardJobCodeManufacturer = restTemplate.getForObject(uri, StandardJobCodeManufacturerResponse.class); assertNotNull("The rest call for standard job code manufacturer returned null.", standardJobCodeManufacturer); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passWebUser()}. */ @Test public void testPassWebUser() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/webUser"); WebUserResponse webUser = restTemplate.getForObject(uri, WebUserResponse.class); assertNotNull("The rest call for web user returned null.", webUser); } /** * Test method for {@link com.crown.passthrough.controller.PassthroughController#passWorkOrder()}. */ @Test public void testPassWorkOrder() throws URISyntaxException { URI uri = new URI(this.uRIPrefix + "/workOrder"); WorkOrderResponse workOrder = restTemplate.getForObject(uri, WorkOrderResponse.class); assertNotNull("The rest call for work order returned null.", workOrder); } }