Bladeren bron

DeathCertificateCapitalisation

Andrew Grant 4 maanden geleden
bovenliggende
commit
c3bf54eae0

+ 11 - 11
src/main/java/scot/carricksoftware/grants/controllers/certificates/deathcertificates/DeathCertificateFormControllerImpl.java

@@ -22,13 +22,13 @@ import scot.carricksoftware.grants.constants.AttributeConstants;
 import scot.carricksoftware.grants.constants.CertificateMappingConstants;
 import scot.carricksoftware.grants.constants.MappingConstants;
 import scot.carricksoftware.grants.constants.ViewConstants;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverterImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverter;
 import scot.carricksoftware.grants.services.certificates.deathcertificates.DeathCertificateService;
 import scot.carricksoftware.grants.services.people.PersonService;
 import scot.carricksoftware.grants.services.places.organisations.OrganisationService;
 import scot.carricksoftware.grants.services.places.places.PlaceService;
-import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidatorImpl;
+import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidator;
 
 @SuppressWarnings("LoggingSimilarMessage")
 @Controller
@@ -37,9 +37,9 @@ public class DeathCertificateFormControllerImpl implements DeathCertificateFormC
     private static final Logger logger = LogManager.getLogger(DeathCertificateFormControllerImpl.class);
     private final DeathCertificateService deathCertificateService;
     @SuppressWarnings({"FieldCanBeLocal", "unused"})
-    private final DeathCertificateCommandConverterImpl deathCertificateCommandConverter;
-    private final DeathCertificateConverterImpl deathCertificateConverter;
-    private final DeathCertificateCommandValidatorImpl deathCertificateCommandValidatorImpl;
+    private final DeathCertificateCommandConverter deathCertificateCommandConverter;
+    private final DeathCertificateConverter deathCertificateConverter;
+    private final DeathCertificateCommandValidator deathCertificateCommandValidator;
     private final PersonService personService;
     private final PlaceService placeService;
     private final OrganisationService organisationService;
@@ -47,9 +47,9 @@ public class DeathCertificateFormControllerImpl implements DeathCertificateFormC
 
 
     public DeathCertificateFormControllerImpl(DeathCertificateService deathCertificateService,
-                                              DeathCertificateCommandConverterImpl deathCertificateCommandConverter,
-                                              DeathCertificateConverterImpl deathCertificateConverter,
-                                              DeathCertificateCommandValidatorImpl deathCertificateCommandValidatorImpl,
+                                              DeathCertificateCommandConverter deathCertificateCommandConverter,
+                                              DeathCertificateConverter deathCertificateConverter,
+                                              DeathCertificateCommandValidator deathCertificateCommandValidator,
                                               PersonService personService,
                                               PlaceService placeService,
                                               OrganisationService organisationService,
@@ -59,7 +59,7 @@ public class DeathCertificateFormControllerImpl implements DeathCertificateFormC
 
 
         this.deathCertificateConverter = deathCertificateConverter;
-        this.deathCertificateCommandValidatorImpl = deathCertificateCommandValidatorImpl;
+        this.deathCertificateCommandValidator = deathCertificateCommandValidator;
         this.personService = personService;
         this.placeService = placeService;
 
@@ -97,7 +97,7 @@ public class DeathCertificateFormControllerImpl implements DeathCertificateFormC
     public String saveOrUpdate(@Valid @ModelAttribute DeathCertificateCommand deathCertificateCommand, BindingResult bindingResult, Model model) {
         logger.debug("DeathCertificateFormControllerImpl::saveOrUpdate");
 
-        deathCertificateCommandValidatorImpl.validate(deathCertificateCommand, bindingResult);
+        deathCertificateCommandValidator.validate(deathCertificateCommand, bindingResult);
         capitaliseDeathCertificate.capitalise(deathCertificateCommand);
 
         if (bindingResult.hasErrors()) {

+ 9 - 4
src/test/java/scot/carricksoftware/grants/controllers/certificates/deathcertificates/DeathCertificateFormControllerSaveOrUpdateTest.java

@@ -12,6 +12,7 @@ import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import org.springframework.ui.Model;
 import org.springframework.validation.BindingResult;
+import scot.carricksoftware.grants.capitalisation.certificates.deathcertificate.CapitaliseDeathCertificate;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
 import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
@@ -20,7 +21,7 @@ import scot.carricksoftware.grants.services.certificates.deathcertificates.Death
 import scot.carricksoftware.grants.services.people.PersonService;
 import scot.carricksoftware.grants.services.places.organisations.OrganisationService;
 import scot.carricksoftware.grants.services.places.places.PlaceService;
-import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidatorImpl;
+import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidator;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
@@ -58,7 +59,10 @@ public class DeathCertificateFormControllerSaveOrUpdateTest {
     BindingResult bindingResultMock;
 
     @Mock
-    private DeathCertificateCommandValidatorImpl deathCertificateCommandValidatorImplMock;
+    CapitaliseDeathCertificate capitaliseDeathCertificateMock;
+
+    @Mock
+    private DeathCertificateCommandValidator deathCertificateCommandValidatorMock;
 
     private DeathCertificateCommand deathCertificateCommand;
 
@@ -68,10 +72,11 @@ public class DeathCertificateFormControllerSaveOrUpdateTest {
         deathCertificateController = new DeathCertificateFormControllerImpl(deathCertificateServiceMock,
                 deathCertificateCommandConverterMock,
                 deathCertificateConverterMock,
-                deathCertificateCommandValidatorImplMock,
+                deathCertificateCommandValidatorMock,
                 personServiceMock,
                 placeServiceMock,
-                organisationServiceMock);
+                organisationServiceMock,
+                capitaliseDeathCertificateMock);
         deathCertificateCommand = new DeathCertificateCommandImpl();
     }
 

+ 11 - 5
src/test/java/scot/carricksoftware/grants/controllers/certificates/deathcertificates/DeathCertificateFormControllerTest.java

@@ -13,6 +13,7 @@ import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import org.springframework.ui.Model;
+import scot.carricksoftware.grants.capitalisation.certificates.deathcertificate.CapitaliseDeathCertificate;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.constants.AttributeConstants;
 import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
@@ -22,7 +23,8 @@ import scot.carricksoftware.grants.services.certificates.deathcertificates.Death
 import scot.carricksoftware.grants.services.people.PersonService;
 import scot.carricksoftware.grants.services.places.organisations.OrganisationService;
 import scot.carricksoftware.grants.services.places.places.PlaceService;
-import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidatorImpl;
+import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidator;
+
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -35,7 +37,7 @@ import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLo
 public class DeathCertificateFormControllerTest {
 
     @SuppressWarnings("unused")
-    private DeathCertificateFormControllerImpl deathCertificateFormController;
+    private DeathCertificateFormController deathCertificateFormController;
 
     @Mock
     private DeathCertificateService deathCertificateServiceMock;
@@ -59,7 +61,10 @@ public class DeathCertificateFormControllerTest {
     private OrganisationService organisationServiceMock;
 
     @Mock
-    private DeathCertificateCommandValidatorImpl deathCertificateCommandValidatorImplMock;
+    private DeathCertificateCommandValidator deathCertificateCommandValidatorMock;
+
+    @Mock
+    CapitaliseDeathCertificate capitaliseDeathCertificateMock;
 
 
     @BeforeEach
@@ -67,10 +72,11 @@ public class DeathCertificateFormControllerTest {
         deathCertificateFormController = new DeathCertificateFormControllerImpl(deathCertificateServiceMock,
                 deathCertificateCommandConverterMock,
                 deathCertificateConverterMock,
-                deathCertificateCommandValidatorImplMock,
+                deathCertificateCommandValidatorMock,
                 personServiceMock,
                 placeServiceMock,
-                organisationServiceMock);
+                organisationServiceMock,
+                capitaliseDeathCertificateMock);
     }
 
     @Test

+ 15 - 10
src/test/java/scot/carricksoftware/grants/controllers/certificates/deathcertificates/DeathCertificateFormControllerValidationTest.java

@@ -13,15 +13,16 @@ import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import org.springframework.ui.Model;
 import org.springframework.validation.BindingResult;
+import scot.carricksoftware.grants.capitalisation.certificates.deathcertificate.CapitaliseDeathCertificate;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverterImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverter;
 import scot.carricksoftware.grants.services.certificates.deathcertificates.DeathCertificateService;
 import scot.carricksoftware.grants.services.people.PersonService;
 import scot.carricksoftware.grants.services.places.organisations.OrganisationService;
 import scot.carricksoftware.grants.services.places.places.PlaceService;
-import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidatorImpl;
+import scot.carricksoftware.grants.validators.certificates.deathcertificate.DeathCertificateCommandValidator;
 
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -32,16 +33,16 @@ import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLo
 public class DeathCertificateFormControllerValidationTest {
 
     @SuppressWarnings("unused")
-    private DeathCertificateFormControllerImpl deathCertificateController;
+    private DeathCertificateFormController deathCertificateController;
 
     @Mock
     private DeathCertificateService deathCertificateServiceMock;
 
     @Mock
-    private DeathCertificateCommandConverterImpl deathCertificateCommandConverterMock;
+    private DeathCertificateCommandConverter deathCertificateCommandConverterMock;
 
     @Mock
-    private DeathCertificateConverterImpl deathCertificateConverterMock;
+    private DeathCertificateConverter deathCertificateConverterMock;
 
 
     @Mock
@@ -57,21 +58,25 @@ public class DeathCertificateFormControllerValidationTest {
     private OrganisationService organisationServiceMock;
 
     @Mock
-    private DeathCertificateCommandValidatorImpl deathCertificateCommandValidatorImplMock;
+    private DeathCertificateCommandValidator deathCertificateCommandValidatorMock;
 
     @Mock
     private Model modelMock;
 
+    @Mock
+    CapitaliseDeathCertificate capitaliseDeathCertificateMock;
+
 
     @BeforeEach
     public void setUp() {
         deathCertificateController = new DeathCertificateFormControllerImpl(deathCertificateServiceMock,
                 deathCertificateCommandConverterMock,
                 deathCertificateConverterMock,
-                deathCertificateCommandValidatorImplMock,
+                deathCertificateCommandValidatorMock,
                 personServiceMock,
                 placeServiceMock,
-                organisationServiceMock);
+                organisationServiceMock,
+                capitaliseDeathCertificateMock);
     }
 
 
@@ -84,7 +89,7 @@ public class DeathCertificateFormControllerValidationTest {
 
         deathCertificateController.saveOrUpdate(deathCertificateCommand, bindingResultMock, modelMock);
 
-        verify(deathCertificateCommandValidatorImplMock).validate(deathCertificateCommand, bindingResultMock);
+        verify(deathCertificateCommandValidatorMock).validate(deathCertificateCommand, bindingResultMock);
     }