-
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.
BpmnBankConfig & BpmnBankConfigDTO Tests
- Loading branch information
1 parent
52cd174
commit 9d0a9ac
Showing
3 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/test/java/it/gov/pagopa/atmlayer/service/model/entity/BpmnBankConfigTest.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,49 @@ | ||
package it.gov.pagopa.atmlayer.service.model.entity; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import it.gov.pagopa.atmlayer.service.model.enumeration.FunctionTypeEnum; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.sql.Timestamp; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@QuarkusTest | ||
public class BpmnBankConfigTest { | ||
|
||
private BpmnBankConfig bpmnBankConfig; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
bpmnBankConfig = new BpmnBankConfig(); | ||
} | ||
|
||
@Test | ||
public void testGettersAndSetters() { | ||
|
||
BpmnBankConfigPK bpmnBankConfigPK = new BpmnBankConfigPK(); | ||
bpmnBankConfig.setBpmnBankConfigPK(bpmnBankConfigPK); | ||
assertEquals(bpmnBankConfigPK, bpmnBankConfig.getBpmnBankConfigPK()); | ||
|
||
FunctionTypeEnum functionType = FunctionTypeEnum.MENU; | ||
bpmnBankConfig.setFunctionType(functionType); | ||
assertEquals(functionType, bpmnBankConfig.getFunctionType()); | ||
|
||
Timestamp createdAt = new Timestamp(System.currentTimeMillis()); | ||
bpmnBankConfig.setCreatedAt(createdAt); | ||
assertEquals(createdAt, bpmnBankConfig.getCreatedAt()); | ||
|
||
Timestamp lastUpdatedAt = new Timestamp(System.currentTimeMillis()); | ||
bpmnBankConfig.setLastUpdatedAt(lastUpdatedAt); | ||
assertEquals(lastUpdatedAt, bpmnBankConfig.getLastUpdatedAt()); | ||
|
||
String createdBy = "name"; | ||
bpmnBankConfig.setCreatedBy(createdBy); | ||
assertEquals(createdBy, bpmnBankConfig.getCreatedBy()); | ||
|
||
String lastUpdatedBy = "surname"; | ||
bpmnBankConfig.setLastUpdatedBy(lastUpdatedBy); | ||
assertEquals(lastUpdatedBy, bpmnBankConfig.getLastUpdatedBy()); | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
src/test/java/it/gov/pagopa/atmlayer/service/model/model/BpmnBankConfigDTOTest.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,101 @@ | ||
package it.gov.pagopa.atmlayer.service.model.model; | ||
|
||
import it.gov.pagopa.atmlayer.service.model.enumeration.FunctionTypeEnum; | ||
import org.junit.jupiter.api.Test; | ||
import java.sql.Timestamp; | ||
import java.util.UUID; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
|
||
public class BpmnBankConfigDTOTest { | ||
@Test | ||
public void testNoArgsConstructor() { | ||
BpmnBankConfigDTO dto = new BpmnBankConfigDTO(); | ||
assertNotNull(dto); | ||
} | ||
|
||
@Test | ||
public void testAllArgsConstructor() { | ||
BpmnBankConfigDTO dto = new BpmnBankConfigDTO( | ||
UUID.randomUUID(), 1L, "acquirer", "branch", "terminal", | ||
FunctionTypeEnum.MENU, new Timestamp(System.currentTimeMillis()), | ||
new Timestamp(System.currentTimeMillis()), "creator", "updator"); | ||
assertNotNull(dto); | ||
} | ||
|
||
@Test | ||
public void testGetterAndSetter() { | ||
BpmnBankConfigDTO dto = new BpmnBankConfigDTO(); | ||
|
||
dto.setBpmnId(UUID.randomUUID()); | ||
assertNotEquals(dto.getBpmnId(), UUID.randomUUID()); | ||
|
||
dto.setBpmnModelVersion(1L); | ||
assertEquals(dto.getBpmnModelVersion(), 1L); | ||
|
||
dto.setAcquirerId("acquirer"); | ||
assertEquals(dto.getAcquirerId(), "acquirer"); | ||
|
||
dto.setBranchId("branch"); | ||
assertEquals(dto.getBranchId(), "branch"); | ||
|
||
dto.setTerminalId("terminal"); | ||
assertEquals(dto.getTerminalId(), "terminal"); | ||
|
||
dto.setFunctionType(FunctionTypeEnum.MENU); | ||
assertEquals(dto.getFunctionType(), FunctionTypeEnum.MENU); | ||
|
||
Timestamp createdAt = new Timestamp(System.currentTimeMillis()); | ||
dto.setCreatedAt(createdAt); | ||
assertEquals(dto.getCreatedAt(), createdAt); | ||
|
||
Timestamp lastUpdatedAt = new Timestamp(System.currentTimeMillis()); | ||
dto.setLastUpdatedAt(lastUpdatedAt); | ||
assertEquals(dto.getLastUpdatedAt(), lastUpdatedAt); | ||
|
||
dto.setCreatedBy("creator"); | ||
assertEquals(dto.getCreatedBy(), "creator"); | ||
|
||
dto.setLastUpdatedBy("updator"); | ||
assertEquals(dto.getLastUpdatedBy(), "updator"); | ||
} | ||
|
||
@Test | ||
public void testEqualsAndHashCode() { | ||
BpmnBankConfigDTO dto1 = new BpmnBankConfigDTO( | ||
UUID.randomUUID(), 1L, "acquirer", "branch", "terminal", | ||
FunctionTypeEnum.MENU, new Timestamp(System.currentTimeMillis()), | ||
new Timestamp(System.currentTimeMillis()), "creator", "updator"); | ||
BpmnBankConfigDTO dto2 = new BpmnBankConfigDTO( | ||
UUID.randomUUID(), 1L, "acquirer", "branch", "terminal", | ||
FunctionTypeEnum.MENU, new Timestamp(System.currentTimeMillis()), | ||
new Timestamp(System.currentTimeMillis()), "creator", "updator"); | ||
|
||
assertNotEquals(dto1, dto2); | ||
assertNotEquals(dto1.hashCode(), dto2.hashCode()); | ||
} | ||
|
||
@Test | ||
public void testToString() { | ||
BpmnBankConfigDTO dto = new BpmnBankConfigDTO( | ||
UUID.randomUUID(), 1L, "acquirer", "branch", "terminal", | ||
FunctionTypeEnum.MENU, new Timestamp(System.currentTimeMillis()), | ||
new Timestamp(System.currentTimeMillis()), "creator", "updator"); | ||
|
||
String expectedToString = "BpmnBankConfigDTO(bpmnId=" + dto.getBpmnId() + | ||
", bpmnModelVersion=" + dto.getBpmnModelVersion() + | ||
", acquirerId=" + dto.getAcquirerId() + | ||
", branchId=" + dto.getBranchId() + | ||
", terminalId=" + dto.getTerminalId() + | ||
", functionType=" + dto.getFunctionType() + | ||
", createdAt=" + dto.getCreatedAt() + | ||
", lastUpdatedAt=" + dto.getLastUpdatedAt() + | ||
", createdBy=" + dto.getCreatedBy() + | ||
", lastUpdatedBy=" + dto.getLastUpdatedBy() + ")"; | ||
|
||
assertEquals(expectedToString, dto.toString()); | ||
} | ||
} |
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