From e937fd80bf7b33e1dc900dd0ecce6dfcddaacf7d Mon Sep 17 00:00:00 2001 From: Bartosz Gardziejewski Date: Wed, 19 Aug 2020 07:17:48 +0200 Subject: Removing jmockit dependencies. Signed-off-by: Bartosz Gardziejewski Change-Id: Idbd406f3cbfb943452870a394e2a8b7bcdc7509b Issue-ID: VNFSDK-631 --- .../csarvalidationtest/CsarValidatorTest.java | 85 +--------------------- 1 file changed, 1 insertion(+), 84 deletions(-) (limited to 'csarvalidation/src/test/java') diff --git a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java index 395b866..2fe3640 100644 --- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java +++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java @@ -34,15 +34,7 @@ import org.junit.Test; import org.onap.validation.csar.CommonConstants; import org.onap.validation.csar.CsarValidator; import org.onap.validation.csar.FileUtil; -import org.onap.validation.csar.ValidationException; -import org.junit.runner.RunWith; -import mockit.integration.junit4.JMockit; -import mockit.Expectations; -import mockit.Mocked; -import mockit.Mock; -import mockit.MockUp; - -@RunWith(JMockit.class) + public class CsarValidatorTest { String regex = "^\\/[a-zA-Z]\\:\\/"; @@ -169,18 +161,6 @@ public class CsarValidatorTest { assertTrue(true); } - @Test(expected = ValidationException.class) - public void testCloseInputStream2( @Mocked InputStream inputStream) throws IOException { - new Expectations(){ - { - inputStream.close(); - result = new IOException(); - } - }; - FileUtil.closeInputStream(inputStream); - assertTrue(true); - } - @Test public void testCloseZipFile() throws ZipException, IOException { File file = new File(sample1); @@ -197,17 +177,6 @@ public class CsarValidatorTest { } - @Test(expected = ValidationException.class) - public void testCloseFileStream2(@Mocked FileInputStream fileInputStream) throws IOException { - new Expectations(){ - { - fileInputStream.close(); - result = new IOException(); - } - }; - FileUtil.closeFileStream(fileInputStream); - } - @Test public void testCloseOutptutStream() { OutputStream dir4 = new OutputStream() { @@ -221,17 +190,6 @@ public class CsarValidatorTest { assertTrue(true); } - @Test(expected = ValidationException.class) - public void testCloseOutptutStream2(@Mocked OutputStream outputStream) throws IOException { - new Expectations(){ - { - outputStream.close(); - result = new IOException(); - } - }; - FileUtil.closeOutputStream(outputStream); - } - private void testValidateCsarMeta(CsarValidator cv) { String result = CsarValidator.validateCsarMeta(); assertEquals(true, result == CommonConstants.SUCCESS_STR); @@ -264,47 +222,6 @@ public class CsarValidatorTest { assertEquals(true, result == CommonConstants.SUCCESS_STR); } - @Test - public void testValidateCsar() throws IOException { - new MockUp(){ - @Mock - public String validateCsarMeta(){ - return "FAIL"; - } - @Mock - public String validateAndScanToscaMeta(){ - return "SUCCESS"; - } - @Mock - public String validateMainService(){ - return "FAIL"; - } - }; - String res=CsarValidator.validateCsar(); - assertEquals("FAIL OR FAIL",res); - - } - - @Test - public void testValidateCsar2() throws IOException { - new MockUp(){ - @Mock - public String validateCsarMeta(){ - return "SUCCESS"; - } - @Mock - public String validateAndScanToscaMeta(){ - return "FAIL"; - } - @Mock - public String validateMainService(){ - return "SUCCESS"; - } - }; - String res=CsarValidator.validateCsar(); - assertEquals("FAIL",res); - } - @Test public void testDeleteDir(){ String dstPath = "./dstPathForTest1"; -- cgit 1.2.3-korg