-
Notifications
You must be signed in to change notification settings - Fork 22
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 #456 from psmf22/develop
chore: fix versionhandling tests
- Loading branch information
Showing
2 changed files
with
40 additions
and
58 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...ore/fcli-tool/src/test/java/com/fortify/cli/tool/versionHandling/VersionHandlingTest.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,40 @@ | ||
package com.fortify.cli.tool.versionHandling; | ||
|
||
import java.io.InputStream; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import com.fortify.cli.tool._common.helper.ToolDownloadDescriptor; | ||
import com.fortify.cli.tool._common.helper.ToolHelper; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
|
||
|
||
public class VersionHandlingTest { | ||
private static final ObjectMapper yamlObjectMapper = new ObjectMapper(new YAMLFactory()); | ||
String toolName = "sc-client"; | ||
|
||
@Test | ||
public void testVersionHandling() throws Exception { | ||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); | ||
String resourceFile = ToolHelper.getResourceFile(toolName, String.format("%s.yaml", toolName)); | ||
try (InputStream file = classLoader.getResourceAsStream(resourceFile)) { | ||
|
||
var downloadDescriptor = yamlObjectMapper.readValue(file, ToolDownloadDescriptor.class); | ||
var d = downloadDescriptor.getVersion("20"); | ||
var d2 = downloadDescriptor.getVersion("20."); | ||
var d3 = downloadDescriptor.getVersion("21.1"); | ||
var d4 = downloadDescriptor.getVersion("21.1.2"); | ||
|
||
Assertions.assertEquals(d.getVersion(), "20.2.4"); | ||
Assertions.assertEquals(d2.getVersion(), "20.2.4"); | ||
Assertions.assertEquals(d3.getVersion(), "21.1.4"); | ||
Assertions.assertEquals(d4.getVersion(), "21.1.2"); | ||
} catch(Exception e) { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
58 changes: 0 additions & 58 deletions
58
...unctional-test/src/ftest/groovy/com/fortify/cli/ftest/tool/ToolVersionHandlingSpec.groovy
This file was deleted.
Oops, something went wrong.