-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #433 from KaziNizamul/main
Improve Test Coverage - EntityStatColumn, CiCdToolTest, SubGenEventTypeTest
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/test/java/io/github/jhipster/online/domain/enums/EntityStatColumnTest.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,19 @@ | ||
package io.github.jhipster.online.domain.enums; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
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()); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/test/java/io/github/jhipster/online/domain/enums/SubGenEventTypeTest.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 io.github.jhipster.online.domain.enums; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
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 | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/test/java/io/github/jhipster/online/service/enums/CiCdToolTest.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,43 @@ | ||
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 = 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()); | ||
} | ||
} |