Skip to content

Commit a23f2a1

Browse files
author
Robert Witkowski
committed
[Separate Models] Fixes after merge
1 parent 22c1d79 commit a23f2a1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

separatemodels/src/test/java/pl/altkom/asc/lab/cqrs/intro/separatemodels/readmodel/PolicyVersionDtoProjectionTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ public class PolicyVersionDtoProjectionTest {
2424
@Autowired
2525
private PolicyVersionDtoProjection policyVersionDtoProjection;
2626

27+
private static String policyNumber = "POL0004";
28+
2729
@Test
2830
public void testCreatePolicyVersionDto() {
2931
//given
30-
Policy policy = PoliciesTestDataBuilder.standardOneYearPolicy(LocalDate.of(2020, 2, 27));
32+
Policy policy = PoliciesTestDataBuilder.standardOneYearPolicy(LocalDate.of(2020, 2, 27), policyNumber);
3133
PolicyVersion policyVersion = policy.getVersions().get(0);
3234

3335
//when
@@ -36,8 +38,7 @@ public void testCreatePolicyVersionDto() {
3638
//then
3739
Assert.assertTrue(policyVersionDtoRepository.findVersionsByPolicyNumber(policy.getNumber()).size() > 0);
3840

39-
int getSecondRecord = 1; // Value of this variable might depends on other tests.
40-
PolicyVersionsListDto.PolicyVersionInfoDto createdPolicyVersion = policyVersionDtoRepository.findVersionsByPolicyNumber(policy.getNumber()).get(getSecondRecord);
41+
PolicyVersionsListDto.PolicyVersionInfoDto createdPolicyVersion = policyVersionDtoRepository.findVersionsByPolicyNumber(policy.getNumber()).get(1);
4142

4243
Assert.assertNotNull(createdPolicyVersion);
4344
Assert.assertEquals(policyVersion.getVersionNumber(), createdPolicyVersion.getNumber());
@@ -49,7 +50,7 @@ public void testCreatePolicyVersionDto() {
4950
@Test
5051
public void testUpdatePolicyVersionDto() {
5152
//given
52-
Policy policy = PoliciesTestDataBuilder.standardOneYearPolicy(LocalDate.of(2020, 2, 27));
53+
Policy policy = PoliciesTestDataBuilder.standardOneYearPolicy(LocalDate.of(2020, 2, 27), policyNumber);
5354
PolicyVersion policyVersion = policy.getVersions().get(0);
5455
policyVersionDtoProjection.createPolicyVersionDto(policy, policyVersion);
5556
PolicyVersion policyVersionUpdate = PoliciesVersionTestDataBuilder.updateStatusOfPolicyVersion(policyVersion, Policy.PolicyStatus.Terminated);
@@ -65,4 +66,4 @@ public void testUpdatePolicyVersionDto() {
6566
Assert.assertNotNull(afterUpdatePolicyVersion);
6667
}
6768

68-
}
69+
}

0 commit comments

Comments
 (0)