Follow BDD Naming Convention

Follow BDD Naming Convention in test cases
This commit is contained in:
Himanshu Mantri 2017-05-24 16:48:12 +05:30
parent aeb33fe72d
commit 4771dc4a3e
3 changed files with 10 additions and 4 deletions

View File

@ -29,6 +29,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -3,6 +3,7 @@ package com.baeldung.didemo.controller;
import java.util.List;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

View File

@ -28,28 +28,28 @@ public class SpringDataInjectionDemoApplicationTests {
CustomerServiceSetterDI setterDI;
@Test
public void testConstructorDI() {
public void givenConstructorDI_whenNumberOfOrdersIsTwo_thenCorrect() {
List<Order> orders = constructorDI.getCustomerOrders(1l);
Assert.assertNotNull(orders);
Assert.assertTrue(orders.size() == 2);
}
@Test
public void testFieldDI() {
public void givenFieldDI_whenNumberOfOrdersIsTwo_thenCorrect() {
List<Order> orders = fieldDI.getCustomerOrders(1l);
Assert.assertNotNull(orders);
Assert.assertTrue(orders.size() == 2);
}
@Test
public void testSetterDI() {
public void givenSetterDI_whenNumberOfOrdersIsTwo_thenCorrect() {
List<Order> orders = setterDI.getCustomerOrders(1l);
Assert.assertNotNull(orders);
Assert.assertTrue(orders.size() == 2);
}
@Test
public void testCombined() {
public void givenAllThreeTypesOfDI_whenNumberOfOrdersIsEqualInAll_thenCorrect() {
List<Order> ordersSetter = setterDI.getCustomerOrders(1l);
List<Order> ordersConstructor = constructorDI.getCustomerOrders(1l);
List<Order> ordersField = fieldDI.getCustomerOrders(1l);