BAEL-2990 Automatic generation of the Builder pattern with FreeBuilder

This commit is contained in:
Chirag Dewan 2019-07-17 08:54:01 +05:30
parent bc3ed26716
commit e40946249a

View File

@ -6,16 +6,16 @@ import org.junit.jupiter.api.Test;
class EmployeeBuilderUnitTest { class EmployeeBuilderUnitTest {
private static final String CITY = "New York"; public static final String NAME = "baeldung";
@Test @Test
public void whenBuildEmployeeWithAddress_thenReturnEmployeeWithValidAddress() { public void whenBuildEmployee_thenReturnValidEmployee() {
// when // when
Employee.Builder emplBuilder = new Employee.Builder(); Employee.Builder emplBuilder = new Employee.Builder();
Employee employee = emplBuilder Employee employee = emplBuilder
.setName("baeldung") .setName(NAME)
.setAge(12) .setAge(12)
.setDepartment("Builder Pattern") .setDepartment("Builder Pattern")
.setDesignation("Author") .setDesignation("Author")
@ -26,7 +26,7 @@ class EmployeeBuilderUnitTest {
.build(); .build();
//then //then
Assertions.assertTrue(employee.getAddress().getCity().equalsIgnoreCase(CITY)); Assertions.assertTrue(employee.getName().equalsIgnoreCase(NAME));
} }
} }