-
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 #499 from psmf22/tool_debricked
chore: fix versionhandling test
- Loading branch information
Showing
1 changed file
with
11 additions
and
23 deletions.
There are no files selected for viewing
34 changes: 11 additions & 23 deletions
34
...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 |
---|---|---|
@@ -1,40 +1,28 @@ | ||
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 = "fod-uploader"; | ||
|
||
@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("5"); | ||
//var d2 = downloadDescriptor.getVersion("20."); | ||
var d3 = downloadDescriptor.getVersion("5.0"); | ||
var d4 = downloadDescriptor.getVersion("5.0.0"); | ||
|
||
Assertions.assertEquals(d.getVersion(), "5.4.0"); | ||
//Assertions.assertEquals(d2.getVersion(), "20.2.4"); | ||
Assertions.assertEquals(d3.getVersion(), "5.0.1"); | ||
Assertions.assertEquals(d4.getVersion(), "5.0.0"); | ||
} catch(Exception e) { | ||
throw e; | ||
} | ||
|
||
var downloadDescriptor = ToolHelper.getToolDownloadDescriptor(toolName);; | ||
var d = downloadDescriptor.getVersion("5"); | ||
//var d2 = downloadDescriptor.getVersion("20."); | ||
var d3 = downloadDescriptor.getVersion("5.0"); | ||
var d4 = downloadDescriptor.getVersion("5.0.0"); | ||
|
||
Assertions.assertEquals(d.getVersion(), "5.4.0"); | ||
//Assertions.assertEquals(d2.getVersion(), "20.2.4"); | ||
Assertions.assertEquals(d3.getVersion(), "5.0.1"); | ||
Assertions.assertEquals(d4.getVersion(), "5.0.0"); | ||
} | ||
} | ||
|