summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test/java
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2019-07-25 07:01:22 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-25 07:01:22 +0000
commitdc6775fbc0779eb2db77ab8215fcb7847b94a4cf (patch)
tree13b2a2cc1f1b37838cf2ad1945546d44a015befd /csarvalidation/src/test/java
parent2a03c94357cb7f77e99f161c136f569ce84d32e9 (diff)
parentb67f6263e48bfcf51c157a9cd7fe774353cc5f38 (diff)
Merge "Option 1 - pnf only"
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java19
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java86
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java46
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java22
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR787966IntegrationTest.java79
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/security/ShaHashCodeGeneratorTest.java54
6 files changed, 289 insertions, 17 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
index 810ef0f..bc27ed1 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
@@ -18,6 +18,7 @@ package org.onap.cvc.csar;
import com.google.common.collect.Lists;
import org.junit.Test;
+import org.onap.cvc.csar.parser.SourcesParser;
import java.util.List;
import java.util.Map;
@@ -26,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PnfCSARArchiveTest {
- public static final String SOURCE_TAG = "Source";
+ private static final String SOURCE_TAG = "Source";
@Test
public void shouldUseDataStoredInManifestMfFileToConfigurePnfCSARArchive() throws Exception {
@@ -41,8 +42,10 @@ public class PnfCSARArchiveTest {
// then
PnfCSARArchive.PnfManifest manifest = (PnfCSARArchive.PnfManifest) pnfCSARArchive.getManifest();
verifyThatMetadataWasSet(manifest);
+ verifyThatCmsSectionWasSet(manifest);
verifyThatSourcesSectionWasSet(manifest);
verifyThatNonManoArtifactsWereSet(manifest);
+ assertThat(pnfCSARArchive.getErrors().size()).isEqualTo(0);
}
}
@@ -57,8 +60,18 @@ public class PnfCSARArchiveTest {
private void verifyThatSourcesSectionWasSet(PnfCSARArchive.PnfManifest manifest) {
- List<String> sources = manifest.getSources();
- assertThat(sources).contains("Definitions/MainServiceTemplate.yaml", "Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml");
+ List<SourcesParser.Source> sources = manifest.getSources();
+ assertThat(sources).contains(
+ new SourcesParser.Source("MRF.yaml", "SHA-256", "09e5a788acb180162c51679ae4c998039fa6644505db2415e35107d1ee213943"),
+ new SourcesParser.Source("scripts/install.sh", "SHA-256", "d0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd8b"),
+ new SourcesParser.Source("https://www.vendor_org.com/MRF/v4.1/scripts/scale/scale.sh", "SHA-256", "36f945953929812aca2701b114b068c71bd8c95ceb3609711428c26325649165")
+ );
+ }
+
+ private void verifyThatCmsSectionWasSet(PnfCSARArchive.PnfManifest manifest) {
+
+ String cms = manifest.getCms();
+ assertThat(cms).isEqualTo("MIGDBgsqhkiG9w0BCRABCaB0MHICAQAwDQYLKoZIhvcNAQkQAwgwXgYJKoZIhvcNAQcBoFEET3icc87PK0nNK9ENqSxItVIoSa0o0S/ISczMs1ZIzkgsKk4tsQ0N1nUMdvb05OXi5XLPLEtViMwvLVLwSE0sKlFIVHAqSk3MBkkBAJv0Fx0=");
}
private void verifyThatNonManoArtifactsWereSet(PnfCSARArchive.PnfManifest manifest) {
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
index 09a2706..3ba37aa 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
@@ -19,10 +19,10 @@ import com.google.common.collect.Lists;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.Test;
+import org.onap.cvc.csar.parser.SourcesParser;
import java.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
@@ -34,7 +34,7 @@ public class PnfManifestParserTest {
private PnfManifestParser pnfManifestParser;
@Before
- public void setUp() throws URISyntaxException, IOException {
+ public void setUp() throws IOException {
pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplate.mf"));
}
@@ -42,7 +42,7 @@ public class PnfManifestParserTest {
public void shouldFetchMetadataFromFile() {
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> metadataListPair = pnfManifestParser.fetchMetadata();
CSARArchive.Manifest.Metadata metadata = metadataListPair.getKey();
- List<CSARArchive.CSARError> errors= metadataListPair.getValue();
+ List<CSARArchive.CSARError> errors = metadataListPair.getValue();
assertThat(metadata.getProductName()).isEqualTo("RadioNode");
assertThat(metadata.getProviderId()).isEqualTo("Ericsson");
@@ -55,21 +55,41 @@ public class PnfManifestParserTest {
@Test
public void shouldFetchSourcesSectionFromFile() {
- Pair<List<String>, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchSourcesSection();
- List<String> sources = sourcesPair.getKey();
+ Pair<List<SourcesParser.Source>, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchSourcesSection();
+ List<SourcesParser.Source> sources = sourcesPair.getKey();
List<CSARArchive.CSARError> errors = sourcesPair.getValue();
- assertThat(sources).contains("Definitions/MainServiceTemplate.yaml", "Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml");
+ assertThat(sources).contains(
+ new SourcesParser.Source("MRF.yaml", "SHA-256", "09e5a788acb180162c51679ae4c998039fa6644505db2415e35107d1ee213943"),
+ new SourcesParser.Source("scripts/install.sh", "SHA-256", "d0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd8b"),
+ new SourcesParser.Source("https://www.vendor_org.com/MRF/v4.1/scripts/scale/scale.sh", "SHA-256", "36f945953929812aca2701b114b068c71bd8c95ceb3609711428c26325649165")
+ );
assertThat(errors.size()).isEqualTo(0);
}
+ @Test
+ public void shouldFetchSourcesFromBrokenFile() throws IOException {
+
+ pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplateWithBrokenSourcesSection.mf"));
+ Pair<List<SourcesParser.Source>, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchSourcesSection();
+ List<SourcesParser.Source> sources = sourcesPair.getKey();
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(sources).contains(
+ new SourcesParser.Source("MRF.yaml", "SHA-256", "09e5a788acb180162c51679ae4c998039fa6644505db2415e35107d1ee213943"),
+ new SourcesParser.Source("some_file.sh", "", ""),
+ new SourcesParser.Source("scripts/install.sh", "", "d0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd8b"),
+ new SourcesParser.Source("https://www.vendor_org.com/MRF/v4.1/scripts/scale/scale.sh", "SHA-256", ""));
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
@Test
public void shouldFetchNonManoArtifactsFromFile() {
Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>> mapListPair = pnfManifestParser.fetchNonManoArtifacts().get();
Map<String, Map<String, List<String>>> nonManoArtifacts = mapListPair.getKey();
- List<CSARArchive.CSARError> errors= mapListPair.getValue();
+ List<CSARArchive.CSARError> errors = mapListPair.getValue();
assertThat(nonManoArtifacts.get("onap_ves_events").get("source"))
.isEqualTo(Lists.newArrayList("Artifacts/Events/VES_registration.yml")
@@ -90,4 +110,56 @@ public class PnfManifestParserTest {
);
assertThat(errors.size()).isEqualTo(0);
}
+
+
+ @Test
+ public void shouldFetchCMS() {
+
+ Pair<String, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchCMS();
+ String cms = sourcesPair.getKey();
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(cms).isEqualTo(
+ "MIGDBgsqhkiG9w0BCRABCaB0MHICAQAwDQYLKoZIhvcNAQkQAwgwXgYJKoZIhvcN" +
+ "AQcBoFEET3icc87PK0nNK9ENqSxItVIoSa0o0S/ISczMs1ZIzkgsKk4tsQ0N1nUM" +
+ "dvb05OXi5XLPLEtViMwvLVLwSE0sKlFIVHAqSk3MBkkBAJv0Fx0="
+ );
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+ @Test
+ public void shouldReportAnErrorWhenCMSSectionDoesNotHaveEndingMarker() throws IOException {
+ pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplateBrokenCMSNoEndMarker.mf"));
+ Pair<String, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchCMS();
+ String cms = sourcesPair.getKey();
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(cms).isEmpty();
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(errors.get(0).getMessage()).isEqualTo("Invalid. Entry [Unable to find END CMS marker!]");
+ }
+
+ @Test
+ public void shouldReturnEmptyCmsWhenBeginMarkerDoesNotExist() throws IOException {
+ pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplateBrokenCMSNoBeginMarker.mf"));
+ Pair<String, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchCMS();
+ String cms = sourcesPair.getKey();
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(cms).isEmpty();
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(errors.get(0).getMessage()).isEqualTo("Invalid. Entry [Unable to find BEGIN CMS marker!]");
+ }
+
+
+ @Test
+ public void shouldReportAnErrorWhenCMSIsNotAtTheEndOfFile() throws IOException {
+ pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplateCMSSectionNotAtTheEnd.mf"));
+ Pair<String, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchCMS();
+
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(errors.get(0).getMessage()).isEqualTo("Invalid. Entry [CMS section is not at the end of file!]");
+ }
} \ No newline at end of file
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java
index 3d46334..c409efc 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java
@@ -18,6 +18,10 @@ package org.onap.cvc.csar;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Test;
+import org.onap.cvc.csar.parser.CmsParser;
+import org.onap.cvc.csar.parser.MetadataParser;
+import org.onap.cvc.csar.parser.NonManoArtifactsParser;
+import org.onap.cvc.csar.parser.SourcesParser;
import java.util.List;
import java.util.stream.Collectors;
@@ -26,6 +30,8 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PnfMetadataParserTest {
+ private static final String FILE_NAME = "fileName";
+
@Test
public void shouldReportAnErrorWhenMetadataSectionIsNotAvailable() {
// given
@@ -38,7 +44,13 @@ public class PnfMetadataParserTest {
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchMetadata();
//then
@@ -64,7 +76,13 @@ public class PnfMetadataParserTest {
);
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchMetadata();
//then
@@ -93,7 +111,13 @@ public class PnfMetadataParserTest {
);
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchMetadata();
//then
@@ -118,7 +142,13 @@ public class PnfMetadataParserTest {
);
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchMetadata();
//then
@@ -142,7 +172,13 @@ public class PnfMetadataParserTest {
);
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<CSARArchive.Manifest.Metadata, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchMetadata();
//then
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java
index 92733bb..388a98f 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java
@@ -18,6 +18,10 @@ package org.onap.cvc.csar;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Test;
+import org.onap.cvc.csar.parser.CmsParser;
+import org.onap.cvc.csar.parser.MetadataParser;
+import org.onap.cvc.csar.parser.NonManoArtifactsParser;
+import org.onap.cvc.csar.parser.SourcesParser;
import java.util.List;
import java.util.Map;
@@ -27,6 +31,8 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PnfNonManoArtifactsParserTest {
+ private static final String FILE_NAME = "fileName";
+
@Test
public void shouldDoNotReportAnErrorWhenNonManoArtifactSectionIsNotAvailable() {
// given
@@ -39,7 +45,13 @@ public class PnfNonManoArtifactsParserTest {
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Optional<Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>>> nonManoArtifacts =
pnfManifestParser.fetchNonManoArtifacts();
@@ -65,7 +77,13 @@ public class PnfNonManoArtifactsParserTest {
);
// when
- PnfManifestParser pnfManifestParser = new PnfManifestParser(lines, "fileName");
+ PnfManifestParser pnfManifestParser = new PnfManifestParser(
+ lines,
+ new MetadataParser(FILE_NAME),
+ new SourcesParser(FILE_NAME),
+ new NonManoArtifactsParser(),
+ new CmsParser(FILE_NAME)
+ );
Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>> data = pnfManifestParser.fetchNonManoArtifacts().get();
//then
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR787966IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR787966IntegrationTest.java
new file mode 100644
index 0000000..eccfe4b
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR787966IntegrationTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2019 Nokia
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.cvc.csar.cc.sol004;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.cvc.csar.CSARArchive;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.configureTestCase;
+import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.convertToMessagesList;
+
+
+public class VTPValidateCSARR787966IntegrationTest {
+
+ private VTPValidateCSARR787966 testCase;
+
+ @Before
+ public void setUp() {
+ testCase = new VTPValidateCSARR787966();
+ }
+
+ @Test
+ public void shouldReturnProperRequestNumber() {
+ assertThat(testCase.getVnfReqsNo()).isEqualTo("R787966");
+ }
+
+ @Test
+ public void shouldValidateProperCsar() throws Exception {
+
+ // given
+ configureTestCase(testCase, "pnf/r787966/csar-option1-valid.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+ @Test
+ public void shouldReportErrorsForInvalidCsar() throws Exception {
+
+ // given
+ configureTestCase(testCase, "pnf/r787966/csar-option1-invalid.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(3);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Unable to find CMS section in manifest!",
+ "Source 'Definitions/MainServiceTemplate.yaml' has wrong hash!",
+ "Source 'Artifacts/Other/my_script.csh' has hash, but unable to find algorithm tag!"
+ );
+ }
+
+
+} \ No newline at end of file
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/security/ShaHashCodeGeneratorTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/security/ShaHashCodeGeneratorTest.java
new file mode 100644
index 0000000..1ea5dd5
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/security/ShaHashCodeGeneratorTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2019 Nokia
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.cvc.csar.security;
+
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.security.NoSuchAlgorithmException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ShaHashCodeGeneratorTest {
+
+ private ShaHashCodeGenerator shaHashCodeGenerator;
+
+ @Before
+ public void setUp(){
+ shaHashCodeGenerator = new ShaHashCodeGenerator();
+ }
+
+ @Test
+ public void shouldGenerateHashCodeSHA256() throws NoSuchAlgorithmException {
+
+ final String hashCode = shaHashCodeGenerator.generateSha256("test".getBytes());
+
+ assertThat(hashCode).isEqualTo(shaHashCodeGenerator.generateSha256("test".getBytes()));
+ assertThat(hashCode).isNotEqualTo(shaHashCodeGenerator.generateSha256("Test".getBytes()));
+ }
+
+ @Test
+ public void shouldGenerateHashCodeSHA512() throws NoSuchAlgorithmException {
+
+ final String hashCode = shaHashCodeGenerator.generateSha512("test".getBytes());
+
+ assertThat(hashCode).isEqualTo(shaHashCodeGenerator.generateSha512("test".getBytes()));
+ assertThat(hashCode).isNotEqualTo(shaHashCodeGenerator.generateSha512("Test".getBytes()));
+ }
+} \ No newline at end of file