Skip to content

Commit

Permalink
feat(FSADT1-999): adding dob processing to Sole Prop
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Nov 21, 2023
1 parent 29321cb commit 90041a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ public interface ForestClientRepository extends ReactiveCrudRepository<ForestCli
ORDER BY CLIENT_NUMBER""")
Flux<ForestClientEntity> findByIncorporationNumber(String incorporationNumber);

@Query("""
SELECT *
FROM THE.FOREST_CLIENT
WHERE
UPPER(LEGAL_FIRST_NAME) = UPPER(:firstName)
AND UPPER(CLIENT_NAME) = UPPER(:lastName)
AND CLIENT_STATUS_CODE = 'ACT'
AND CLIENT_TYPE_CODE = 'I'
ORDER BY CLIENT_NUMBER""")
Flux<ForestClientEntity> findByIndividualNames(String firstName, String lastName);

@Query("""
SELECT *
FROM THE.FOREST_CLIENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public Mono<MatcherResult> matches(SubmissionInformationDto submission) {

return
forestClientRepository
.findByIndividualNames(
.findByIndividual(
ProcessorUtil.splitName(submission.corporationName())[1],
ProcessorUtil.splitName(submission.corporationName())[0]
ProcessorUtil.splitName(submission.corporationName())[0],
submission.dateOfBirth()!= null ? submission.dateOfBirth().atStartOfDay() : null
)
.doOnNext(entity -> log.info("Found a match {}", entity))
.map(ForestClientEntity::getClientNumber)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ca.bc.gov.app.service.processor;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand All @@ -9,6 +10,7 @@
import ca.bc.gov.app.dto.SubmissionInformationDto;
import ca.bc.gov.app.entity.legacy.ForestClientEntity;
import ca.bc.gov.app.repository.legacy.ForestClientRepository;
import java.time.LocalDate;
import java.util.stream.Stream;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -41,7 +43,7 @@ void shouldMatchOrNot(
Flux<ForestClientEntity> mockData
) {

when(repository.findByIndividualNames(anyString(),anyString()))
when(repository.findByIndividual(anyString(), anyString(), any()))
.thenReturn(mockData);

StepVerifier.FirstStep<MatcherResult> verifier =
Expand All @@ -62,19 +64,22 @@ private static Stream<Arguments> legalName() {
return
Stream.of(
Arguments.of(
new SubmissionInformationDto("James Frank", null, null, null, "USP"),
new SubmissionInformationDto("James Frank", LocalDate.of(2023, 4, 5), null, null,
"USP"),
true,
null,
Flux.empty()
),
Arguments.of(
new SubmissionInformationDto("Marco Polo", null, null, null, "RSP"),
new SubmissionInformationDto("Marco Polo", LocalDate.of(2023, 9, 12), null, null,
"RSP"),
false,
new MatcherResult("corporationName", String.join(",", "00000000")),
Flux.just(new ForestClientEntity().withClientNumber("00000000"))
),
Arguments.of(
new SubmissionInformationDto("Lucca DeBiaggio", null, null, null, "USP"),
new SubmissionInformationDto("Lucca DeBiaggio", LocalDate.of(2023, 10, 11), null,
null, "USP"),
false,
new MatcherResult("corporationName", String.join(",", "00000000", "00000001")),
Flux.just(new ForestClientEntity().withClientNumber("00000000"),
Expand Down

0 comments on commit 90041a7

Please sign in to comment.