Skip to content

Commit

Permalink
chenge test
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanotamburini committed Dec 23, 2024
1 parent 4029eeb commit 97a6921
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
@ExtendWith(MockitoExtension.class)
class IufClassificationActivityTest {
@Mock
private PaymentsReportingDao paymentsReportingDao;
private PaymentsReportingDao paymentsReportingDaoMock;

@Mock
private ClassificationDao classificationDao;
private ClassificationDao classificationDaoMock;

private IufClassificationActivity iufClassificationActivity;

Expand All @@ -38,12 +38,12 @@ class IufClassificationActivityTest {

@BeforeEach
void init() {
iufClassificationActivity = new IufClassificationActivityImpl(paymentsReportingDao, classificationDao);
iufClassificationActivity = new IufClassificationActivityImpl(paymentsReportingDaoMock, classificationDaoMock);
}

@AfterEach
void verifyNoMoreInteractions(){
Mockito.verifyNoMoreInteractions(paymentsReportingDao);
Mockito.verifyNoMoreInteractions(paymentsReportingDaoMock,classificationDaoMock);
}

@Test
Expand Down Expand Up @@ -73,16 +73,16 @@ void givenReportedTransferWhenClassifyThenOk() {
.success(true)
.build();

when(paymentsReportingDao.findByOrganizationIdAndIuf(ORGANIZATIONID, IUF))
when(paymentsReportingDaoMock.findByOrganizationIdAndIuf(ORGANIZATIONID, IUF))
.thenReturn(expectedPaymentsReportingDTOS);

IufClassificationActivityResult iufClassificationActivityResult =
iufClassificationActivity.classify(ORGANIZATIONID, TREASURYID, IUF);

assertEquals(iufClassificationActivityResult,expectedIufClassificationActivityResult);

Mockito.verify(paymentsReportingDao, Mockito.times(1)).findByOrganizationIdAndIuf(ORGANIZATIONID, IUF);
Mockito.verify(classificationDao, Mockito.times(0)).save(classificationDTO);
Mockito.verify(paymentsReportingDaoMock, Mockito.times(1)).findByOrganizationIdAndIuf(ORGANIZATIONID, IUF);
Mockito.verify(classificationDaoMock, Mockito.times(0)).save(classificationDTO);
}

@Test
Expand All @@ -97,16 +97,16 @@ void givenNoReportedTransferWhenClassifyThenAnomalyClassificationSave() {
.success(true)
.build();

when(paymentsReportingDao.findByOrganizationIdAndIuf(ORGANIZATIONID, IUF))
when(paymentsReportingDaoMock.findByOrganizationIdAndIuf(ORGANIZATIONID, IUF))
.thenReturn(new ArrayList<>());

IufClassificationActivityResult iufClassificationActivityResult =
iufClassificationActivity.classify(ORGANIZATIONID, TREASURYID, IUF);

assertEquals(iufClassificationActivityResult,expectedIufClassificationActivityResult);

Mockito.verify(paymentsReportingDao, Mockito.times(1)).findByOrganizationIdAndIuf(ORGANIZATIONID, IUF);
Mockito.verify(classificationDao, Mockito.times(1)).save(classificationDTO);
Mockito.verify(paymentsReportingDaoMock, Mockito.times(1)).findByOrganizationIdAndIuf(ORGANIZATIONID, IUF);
Mockito.verify(classificationDaoMock, Mockito.times(1)).save(classificationDTO);
}
}

2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.1-SNAPSHOT
1.20.2-SNAPSHOT

0 comments on commit 97a6921

Please sign in to comment.