diff --git a/src/test/java/io/github/jhipster/online/domain/enums/EntityStatColumnTest.java b/src/test/java/io/github/jhipster/online/domain/enums/EntityStatColumnTest.java new file mode 100644 index 00000000..4f5d91c2 --- /dev/null +++ b/src/test/java/io/github/jhipster/online/domain/enums/EntityStatColumnTest.java @@ -0,0 +1,17 @@ +package io.github.jhipster.online.domain.enums; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class EntityStatColumnTest { + @Test + public void testGetDatabaseValue() { + assertEquals("fields", EntityStatColumn.FIELDS.getDatabaseValue()); + assertEquals("relationships", EntityStatColumn.RELATIONSHIPS.getDatabaseValue()); + assertEquals("pagination", EntityStatColumn.PAGINATION.getDatabaseValue()); + assertEquals("dto", EntityStatColumn.DTO.getDatabaseValue()); + assertEquals("service", EntityStatColumn.SERVICE.getDatabaseValue()); + assertEquals("fluentMethods", EntityStatColumn.FLUENT_METHODS.getDatabaseValue()); + assertEquals("date", EntityStatColumn.DATE.getDatabaseValue()); + } +} diff --git a/src/test/java/io/github/jhipster/online/domain/enums/SubGenEventTypeTest.java b/src/test/java/io/github/jhipster/online/domain/enums/SubGenEventTypeTest.java new file mode 100644 index 00000000..ee7a86a8 --- /dev/null +++ b/src/test/java/io/github/jhipster/online/domain/enums/SubGenEventTypeTest.java @@ -0,0 +1,40 @@ +package io.github.jhipster.online.domain.enums; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +public class SubGenEventTypeTest { + + @Test + public void testGetDatabaseValue () { + assertEquals("heroku", SubGenEventType.HEROKU.getDatabaseValue()); + assertEquals("cloudfoundry", SubGenEventType.CLOUDFOUNDRY.getDatabaseValue()); + assertEquals("aws", SubGenEventType.AWS.getDatabaseValue()); + assertEquals("ci-cd", SubGenEventType.CI_CD.getDatabaseValue()); + assertEquals("", SubGenEventType.CLIENT.getDatabaseValue()); + assertEquals("docker-compose", SubGenEventType.DOCKER_COMPOSE.getDatabaseValue()); + assertEquals("export-jdl", SubGenEventType.EXPORT_JDL.getDatabaseValue()); + assertEquals("import-jdl", SubGenEventType.IMPORT_JDL.getDatabaseValue()); + assertEquals("kubernetes", SubGenEventType.KUBERNETES.getDatabaseValue()); + assertEquals("languages", SubGenEventType.LANGUAGES.getDatabaseValue()); + assertEquals("openshift", SubGenEventType.OPENSHIFT.getDatabaseValue()); + assertEquals("rancher-compose", SubGenEventType.RANCHER_COMPOSE.getDatabaseValue()); + assertEquals("server", SubGenEventType.SERVER.getDatabaseValue()); + assertEquals("spring-controller", SubGenEventType.SPRING_CONTROLLER.getDatabaseValue()); + assertEquals("upgrade", SubGenEventType.UPGRADE.getDatabaseValue()); + } + @Test + public void testGetDeploymentTools () { + SubGenEventType[] deploymentTools = SubGenEventType.getDeploymentTools(); + assertEquals(5, deploymentTools.length); + assertArrayEquals( + new SubGenEventType[] { + SubGenEventType.HEROKU, + SubGenEventType.CLOUDFOUNDRY, + SubGenEventType.AWS, + SubGenEventType.OPENSHIFT, + SubGenEventType.KUBERNETES + }, + deploymentTools + ); + } +} diff --git a/src/test/java/io/github/jhipster/online/service/enums/CiCdToolTest.java b/src/test/java/io/github/jhipster/online/service/enums/CiCdToolTest.java new file mode 100644 index 00000000..a34767d3 --- /dev/null +++ b/src/test/java/io/github/jhipster/online/service/enums/CiCdToolTest.java @@ -0,0 +1,42 @@ +package io.github.jhipster.online.service.enums; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Optional; +import org.junit.jupiter.api.Test; + +public class CiCdToolTest { + @Test + public void testGetByName() { + Optional ciCdTool = CiCdTool.getByName("TRAVIS"); + assertEquals(CiCdTool.TRAVIS, ciCdTool.orElse(null)); + + ciCdTool = CiCdTool.getByName("JENKINS"); + assertEquals(CiCdTool.JENKINS, ciCdTool.orElse(null)); + + /* testing a CI_CD tool which dont exist */ + ciCdTool = CiCdTool.getByName("UNKNOWN_TOOL"); + assertEquals(Optional.empty(), ciCdTool); + } + + @Test + public void testCommand() { + assertEquals("travis", CiCdTool.TRAVIS.command()); + assertEquals("github", CiCdTool.GITHUB.command()); + assertEquals("circle", CiCdTool.CIRCLE.command()); + } + + @Test + public void testBranchName() { + assertEquals("jhipster-travis-complement", CiCdTool.TRAVIS.branchName("complement")); + assertEquals("jhipster-github-complement", CiCdTool.GITHUB.branchName("complement")); + } + + @Test + public void testGetCiCdToolName() { + assertEquals("GitLab", CiCdTool.GITLAB.getCiCdToolName()); + assertEquals("GitHub", CiCdTool.GITHUB.getCiCdToolName()); + assertEquals("Azure", CiCdTool.AZURE.getCiCdToolName()); + assertEquals("Circle", CiCdTool.CIRCLE.getCiCdToolName()); + } +}