Add a new section in Lombok builder article - Minor Fixes

This commit is contained in:
Ricardo Caldas 2020-09-19 19:58:33 -03:00
parent 56cbfb1c6f
commit cb8bae53a2
2 changed files with 8 additions and 7 deletions

View File

@ -8,7 +8,8 @@ import lombok.NonNull;
@Getter
public class RequiredFieldAnnotation {
@NonNull String name;
@NonNull
String name;
String description;
public static RequiredFieldAnnotationBuilder builder(String name) {

View File

@ -1,21 +1,21 @@
package com.baeldung.lombok.builder;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class RequiredFieldAnnotationTest {
public class RequiredFieldAnnotationUnitTest {
RequiredFieldAnnotation requiredFieldTest;
@BeforeEach
void setUp() {
@Before
public void setUp() {
requiredFieldTest = RequiredFieldAnnotation.builder("NameField").description("Field Description").build();
}
@Test
public void givenBuilderWithRequiredParameter_thenParameterIsPresent() {
assertEquals(requiredFieldTest.getName(), "NameField");
assertEquals("NameField", requiredFieldTest.getName());
}
}