generated from pagopa/template-payments-java-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/java/it/gov/pagopa/pu/worker/ingestionflowfile/mapper/IngestionFlowFileMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
package it.gov.pagopa.pu.worker.ingestionflowfile.mapper; | ||
|
||
import it.gov.pagopa.payhub.activities.dto.IngestionFlowFileDTO; | ||
import it.gov.pagopa.pu.worker.ingestionflowfile.model.IngestionFlowFile; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class IngestionFlowFileMapper { | ||
|
||
public IngestionFlowFileDTO mapIngestionFlowFile2DTO(IngestionFlowFile model) { | ||
return IngestionFlowFileDTO.builder().build(); | ||
} | ||
|
||
public IngestionFlowFile mapIngestionFlowFileDTO2Model(IngestionFlowFileDTO dto) { | ||
return IngestionFlowFile.builder().build(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/java/it/gov/pagopa/pu/worker/ingestionflowfile/IngestionFlowFileDaoImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package it.gov.pagopa.pu.worker.ingestionflowfile; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class IngestionFlowFileDaoImplTest { | ||
|
||
@BeforeEach | ||
void setUp() { | ||
} | ||
|
||
@Test | ||
void findById() { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...st/java/it/gov/pagopa/pu/worker/ingestionflowfile/mapper/IngestionFlowFileMapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package it.gov.pagopa.pu.worker.ingestionflowfile.mapper; | ||
|
||
import it.gov.pagopa.payhub.activities.dto.IngestionFlowFileDTO; | ||
import it.gov.pagopa.pu.worker.ingestionflowfile.model.IngestionFlowFile; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static it.gov.pagopa.pu.worker.util.TestUtils.checkNotNullFields; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
class IngestionFlowFileMapperTest { | ||
private IngestionFlowFileMapper mapper; | ||
|
||
@BeforeEach | ||
void setUp() { mapper = new IngestionFlowFileMapper(); } | ||
|
||
@Test | ||
void mapIngestionFlowFile2DTO() { | ||
IngestionFlowFile model = IngestionFlowFile.builder().ingestionFlowFileId(123L).build();; | ||
IngestionFlowFileDTO result = mapper.mapIngestionFlowFile2DTO(model); | ||
|
||
assertNotNull(result); | ||
checkNotNullFields(result); | ||
} | ||
|
||
@Test | ||
void mapIngestionFlowFileDTO2Model() { | ||
IngestionFlowFileDTO dto = IngestionFlowFileDTO.builder().build(); | ||
IngestionFlowFile result = mapper.mapIngestionFlowFileDTO2Model(dto); | ||
assertNotNull(result); | ||
checkNotNullFields(result); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
.../java/it/gov/pagopa/pu/worker/ingestionflowfile/service/IngestionFlowFileServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package it.gov.pagopa.pu.worker.ingestionflowfile.service; | ||
|
||
import it.gov.pagopa.pu.worker.ingestionflowfile.model.IngestionFlowFile; | ||
import it.gov.pagopa.pu.worker.ingestionflowfile.repository.IngestionFlowFileRepository; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import java.util.Optional; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.Mockito.*; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class IngestionFlowFileServiceTest { | ||
|
||
@Mock | ||
private IngestionFlowFileRepository repositoryMock; | ||
|
||
private IngestionFlowFileService service; | ||
|
||
@BeforeEach | ||
void setUp() { service = new IngestionFlowFileService(repositoryMock); } | ||
|
||
@Test | ||
void whenGetIngestionFlowFileThenGetResult() { | ||
// Arrange | ||
Long id = 123L; | ||
IngestionFlowFile ingestionFlowFile = IngestionFlowFile.builder() | ||
.ingestionFlowFileId(id) | ||
.build(); | ||
|
||
when(repositoryMock.findById(id)).thenReturn(Optional.of(ingestionFlowFile)); | ||
|
||
// Act | ||
Optional<IngestionFlowFile> result = service.getIngestionFlowFile(id); | ||
|
||
// Assert | ||
assertEquals(Optional.of(ingestionFlowFile), result); | ||
verify(repositoryMock, times(1)).findById(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters