api/src/test/java/com/codechallenge/api/ApiApplicationTests.java
@Test
	void testGetAllBoats() {
		
		//create boats
					
		BoatVO boatCreated = createTestBoat(1, "Test1", DOCKED);		
		ResponseEntity<Boat> postResponse = restTemplate.postForEntity(getRootUrl() + "/boats",boatCreated, Boat.class);
		Assertions.assertNotNull(postResponse);
		Assertions.assertNotNull(postResponse.getBody());
		
		BoatVO boatCreated2 = createTestBoat(2, "Test2", OUTBOUND);		
		ResponseEntity<Boat> postResponse2 = restTemplate.postForEntity(getRootUrl() + "/boats",boatCreated2, Boat.class);
		Assertions.assertNotNull(postResponse2);
		Assertions.assertNotNull(postResponse2.getBody());

		//get boats
		
		HttpHeaders headers = new HttpHeaders();
		HttpEntity<String> entity = new HttpEntity<String>(null, headers);

		ResponseEntity<String> response = restTemplate.exchange(getRootUrl() + "/boats",
				HttpMethod.GET, entity, String.class);

		Assertions.assertNotNull(response.getBody());
		Assertions.assertEquals(200,response.getStatusCodeValue());
	}
//Create boats and test get all the boats
Create boats and test get all the boats
Create boats and test get all the boats
@Test
	void testGetAllBoats() {
		BoatVO boatCreated = createTestBoat(1, "Test1", DOCKED);		
		ResponseEntity<Boat> postResponse = restTemplate.postForEntity(getRootUrl() + "/boats",boatCreated, Boat.class);
		Assertions.assertNotNull(postResponse);
		Assertions.assertNotNull(postResponse.getBody());
		BoatVO boatCreated2 = createTestBoat(2, "Test2", OUTBOUND);		
		ResponseEntity<Boat> postResponse2 = restTemplate.postForEntity(getRootUrl() + "/boats",boatCreated2, Boat.class);
		Assertions.assertNotNull(postResponse2);
		Assertions.assertNotNull(postResponse2.getBody());
		HttpHeaders headers = new HttpHeaders();
		HttpEntity<String> entity = new HttpEntity<String>(null, headers);
		ResponseEntity<String> response = restTemplate.exchange(getRootUrl() + "/boats",
				HttpMethod.GET, entity, String.class);
		Assertions.assertNotNull(response.getBody());
		Assertions.assertEquals(200,response.getStatusCodeValue());
	}
@ Test void testGetAllBoats ( ) { BoatVO boatCreated = createTestBoat ( 1 , "Test1" , DOCKED ) ; ResponseEntity < Boat > postResponse = restTemplate . postForEntity ( getRootUrl ( ) + "/boats" , boatCreated , Boat . class ) ; Assertions . assertNotNull ( postResponse ) ; Assertions . assertNotNull ( postResponse . getBody ( ) ) ; BoatVO boatCreated2 = createTestBoat ( 2 , "Test2" , OUTBOUND ) ; ResponseEntity < Boat > postResponse2 = restTemplate . postForEntity ( getRootUrl ( ) + "/boats" , boatCreated2 , Boat . class ) ; Assertions . assertNotNull ( postResponse2 ) ; Assertions . assertNotNull ( postResponse2 . getBody ( ) ) ; HttpHeaders headers = new HttpHeaders ( ) ; HttpEntity < String > entity = new HttpEntity < String > ( null , headers ) ; ResponseEntity < String > response = restTemplate . exchange ( getRootUrl ( ) + "/boats" , HttpMethod . GET , entity , String . class ) ; Assertions . assertNotNull ( response . getBody ( ) ) ; Assertions . assertEquals ( 200 , response . getStatusCodeValue ( ) ) ; }
Create boats and test get all the boats
Create boats and test get all the boats
//create boats //get boats