<version>4.11</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.8.2</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
Resource[] resources = OnapCommandDiscoveryUtils.findResources(pattern);
if (resources != null && resources.length > 0) { //NOSONAR
for (Resource res : resources) {
- if ((res.getFilename() != null) && (res.getFilename().equals(fileName))) {
+ if ((res.getFilename() != null) && (res.getFilename().equals(fileName))) { //NOSONAR
return res;
}
}
package org.onap.cli.fw.conf;
import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class OnapCommandConfgTest {
@Test
public void addPropertiesTest() {
-
- OnapCommandConfig.getPropertyValue("cli.schema.profile.confs");
+ assertDoesNotThrow(() -> OnapCommandConfig.getPropertyValue("cli.schema.profile.confs"));
}
}
import static org.junit.Assert.*;
import java.io.IOException;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class OnapCommandProfileStoreTest {
OnapCommandProfileStore onapCommandProfileStore;
@Test
public void removeTest() {
- onapCommandProfileStore.add("abc", "abc", "abc");
- onapCommandProfileStore.remove("abc","abc");
+ assertDoesNotThrow(() -> onapCommandProfileStore.add("abc", "abc", "abc"));
+ assertDoesNotThrow(() -> onapCommandProfileStore.remove("abc","abc"));
}
@AfterClass
<version>4.11</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.8.2</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
import org.onap.cli.fw.error.OnapCommandInvalidSchema;
import org.onap.cli.fw.utils.OnapCommandDiscoveryUtils;
import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class OnapCliMainTest {
@Test
public void testHelp() {
- this.handle(new String[] { "--help" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "--help" }));
}
@Test
public void testHelpShort() {
- this.handle(new String[] { "-h" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "-h" }));
}
@Test
public void testVersion() {
- this.handle(new String[] { "--version" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "--version" }));
}
@Test
public void testVersionShort() {
- this.handle(new String[] { "-v" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "-v" }));
}
@Test
public void testHelpSampleCommand() {
- this.handle(new String[] { "sample-test", "--help" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "sample-test", "--help" }));
}
@Test
public void testHelpSampleCommandShort() {
- this.handle(new String[] { "sample-test", "-h" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "sample-test", "-h" }));
}
@Test
public void testVersionSampleCommandShort() {
- this.handle(new String[] { "sample-test", "-v" });
+ assertDoesNotThrow(() -> this.handle(new String[] { "sample-test", "-v" }));
}
@Test
OnapCommandRegistrar.getRegistrar().addParamCache("host-username", "paramValue");
OnapCommandRegistrar.getRegistrar().addParamCache("host-password", "paramValue");
OnapCommandRegistrar.getRegistrar().addParamCache("host-url", "paramValue");
- this.handle(new String[] { "sample-test", "--string-param", "test"});
+ assertDoesNotThrow(() -> this.handle(new String[] { "sample-test", "--string-param", "test"}));
}
@Test
public void testHandleSampleCommandFailure() throws OnapCommandException {
- this.handle(new String[] { "sample-test", "--string-param"});
+ assertDoesNotThrow(() -> this.handle(new String[] { "sample-test", "--string-param"}));
}
@Test
cli = new OnapCli(new String[] {});
mockConsoleReader();
- cli.handleInteractive();
+ assertDoesNotThrow(() -> cli.handleInteractive());
}
map.put("sampleid","sample1");
map.put("samplefileid","schema-validate-sample.yaml");
map.put("moco","schema-validate-moco.json");
- list.add(map);
+ assertDoesNotThrow(() -> list.add(map));
return list;
}
};
import java.util.Set;
import org.junit.Test;
import org.onap.cli.fw.conf.OnapCommandConstants;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
* This command helps to test the Command functionalities.
OnapCommand sample = OnapCommandRegistrar.getRegistrar().get("sample-test");
sample.setParameters(parameters);
- sample.execute();
+ assertDoesNotThrow(() -> sample.execute());
}
}
<version>4.11</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.8.2</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
import org.onap.cli.fw.http.connect.HttpResult;
import org.onap.cli.fw.http.connect.OnapHttpConnection;
import org.onap.cli.fw.http.error.OnapCommandHttpFailure;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class OnapHttpConnectionTest {
public void httpUnSecuredCloseExceptionTest() throws IOException {
inp.setMethod("other");
con = new OnapHttpConnection();
- con.close();
+ assertDoesNotThrow(() -> con.close());
}
@Test
<version>4.11</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.8.2</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
import java.io.IOException;
import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class MockJsonGeneratorTest {
mockResponse.setStatus(200);
mockResponse.setJson("{\"value\" : \"234sdf-345\"}");
- MockJsonGenerator.generateMocking(mockRequest, mockResponse, "target/test");
+ assertDoesNotThrow(() -> MockJsonGenerator.generateMocking(mockRequest, mockResponse, "target/test"));
}
}
<version>1.19</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.8.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
import java.util.Arrays;
import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class SampleYamlGeneratorTest {
@Test
public void testGenerateSampleYaml() throws IOException {
- SampleYamlGenerator.generateSampleYaml("testcmd", Arrays.asList("-a", "argument"),
- "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false, "sample1");
+ assertDoesNotThrow(() -> SampleYamlGenerator.generateSampleYaml("testcmd", Arrays.asList("-a", "argument"),
+ "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false, "sample1"));
}
@Test
public void testGenerateSampleYamlForWriteMultilineKeyValue() throws IOException {
- SampleYamlGenerator.generateSampleYaml("testcmd-multiline", Arrays.asList("-a", "argument"),
+ assertDoesNotThrow(() -> SampleYamlGenerator.generateSampleYaml("testcmd-multiline", Arrays.asList("-a", "argument"),
"+--------+\n+testval1 +\n+argument1+\n+testval2 +\n+argument2+", "test-version-1.0",
- "target/test-multiline.yaml", true, "sample1");
+ "target/test-multiline.yaml", true, "sample1"));
}
}