Follow BDD Naming Convention
Follow BDD Naming Convention in test cases
This commit is contained in:
		
							parent
							
								
									aeb33fe72d
								
							
						
					
					
						commit
						4771dc4a3e
					
				| @ -29,6 +29,11 @@ | |||||||
| 			<groupId>org.springframework.boot</groupId> | 			<groupId>org.springframework.boot</groupId> | ||||||
| 			<artifactId>spring-boot-starter-web</artifactId> | 			<artifactId>spring-boot-starter-web</artifactId> | ||||||
| 		</dependency> | 		</dependency> | ||||||
|  | 		 | ||||||
|  | 		<dependency> | ||||||
|  | 			<groupId>org.springframework.boot</groupId> | ||||||
|  | 			<artifactId>spring-boot-starter-test</artifactId> | ||||||
|  | 		</dependency> | ||||||
| 	</dependencies> | 	</dependencies> | ||||||
| 
 | 
 | ||||||
| 	<build> | 	<build> | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ package com.baeldung.didemo.controller; | |||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestMethod; | import org.springframework.web.bind.annotation.RequestMethod; | ||||||
| import org.springframework.web.bind.annotation.RequestParam; | import org.springframework.web.bind.annotation.RequestParam; | ||||||
|  | |||||||
| @ -28,28 +28,28 @@ public class SpringDataInjectionDemoApplicationTests { | |||||||
|     CustomerServiceSetterDI setterDI; |     CustomerServiceSetterDI setterDI; | ||||||
|      |      | ||||||
| 	@Test | 	@Test | ||||||
| 	public void testConstructorDI() { | 	public void givenConstructorDI_whenNumberOfOrdersIsTwo_thenCorrect() { | ||||||
| 	    List<Order> orders = constructorDI.getCustomerOrders(1l); | 	    List<Order> orders = constructorDI.getCustomerOrders(1l); | ||||||
| 	    Assert.assertNotNull(orders); | 	    Assert.assertNotNull(orders); | ||||||
| 	    Assert.assertTrue(orders.size() == 2); | 	    Assert.assertTrue(orders.size() == 2); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	@Test | 	@Test | ||||||
|     public void testFieldDI() { |     public void givenFieldDI_whenNumberOfOrdersIsTwo_thenCorrect() { | ||||||
|         List<Order> orders = fieldDI.getCustomerOrders(1l); |         List<Order> orders = fieldDI.getCustomerOrders(1l); | ||||||
|         Assert.assertNotNull(orders); |         Assert.assertNotNull(orders); | ||||||
|         Assert.assertTrue(orders.size() == 2); |         Assert.assertTrue(orders.size() == 2); | ||||||
|     } |     } | ||||||
| 	 | 	 | ||||||
| 	@Test | 	@Test | ||||||
|     public void testSetterDI() { |     public void givenSetterDI_whenNumberOfOrdersIsTwo_thenCorrect() { | ||||||
|         List<Order> orders = setterDI.getCustomerOrders(1l); |         List<Order> orders = setterDI.getCustomerOrders(1l); | ||||||
|         Assert.assertNotNull(orders); |         Assert.assertNotNull(orders); | ||||||
|         Assert.assertTrue(orders.size() == 2); |         Assert.assertTrue(orders.size() == 2); | ||||||
|     } |     } | ||||||
| 	 | 	 | ||||||
| 	@Test | 	@Test | ||||||
|     public void testCombined() { |     public void givenAllThreeTypesOfDI_whenNumberOfOrdersIsEqualInAll_thenCorrect() { | ||||||
|         List<Order> ordersSetter = setterDI.getCustomerOrders(1l); |         List<Order> ordersSetter = setterDI.getCustomerOrders(1l); | ||||||
|         List<Order> ordersConstructor = constructorDI.getCustomerOrders(1l); |         List<Order> ordersConstructor = constructorDI.getCustomerOrders(1l); | ||||||
|         List<Order> ordersField = fieldDI.getCustomerOrders(1l); |         List<Order> ordersField = fieldDI.getCustomerOrders(1l); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user