diff --git a/enricher/src/main/java/com/ibm/enricher/Enricher.java b/enricher/src/main/java/com/ibm/enricher/Enricher.java index 8a32e04d..f4e84073 100644 --- a/enricher/src/main/java/com/ibm/enricher/Enricher.java +++ b/enricher/src/main/java/com/ibm/enricher/Enricher.java @@ -20,10 +20,9 @@ package com.ibm.enricher; import com.ibm.mapper.model.INode; -import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nonnull; import java.util.Collection; +import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This enricher instance operates on a language-agnostic level, meaning it will enrich the given @@ -42,11 +41,13 @@ public class Enricher implements IEnricher { public static Collection enrich(@Nonnull final Collection nodes) { final Enricher enricher = new Enricher(); return nodes.stream() - .map(node -> { - final INode enriched = enricher.enrich(node); - enrich(enriched.getChildren().values()).forEach(enriched::append); - return enriched; - }).toList(); + .map( + node -> { + final INode enriched = enricher.enrich(node); + enrich(enriched.getChildren().values()).forEach(enriched::append); + return enriched; + }) + .toList(); } /** diff --git a/enricher/src/main/java/com/ibm/enricher/IEnricher.java b/enricher/src/main/java/com/ibm/enricher/IEnricher.java index 430f663d..d39826a7 100644 --- a/enricher/src/main/java/com/ibm/enricher/IEnricher.java +++ b/enricher/src/main/java/com/ibm/enricher/IEnricher.java @@ -20,7 +20,6 @@ package com.ibm.enricher; import com.ibm.mapper.model.INode; - import javax.annotation.Nonnull; public interface IEnricher { diff --git a/enricher/src/main/java/com/ibm/enricher/algorithm/AESEnricher.java b/enricher/src/main/java/com/ibm/enricher/algorithm/AESEnricher.java index 3882b946..881dbf3b 100644 --- a/enricher/src/main/java/com/ibm/enricher/algorithm/AESEnricher.java +++ b/enricher/src/main/java/com/ibm/enricher/algorithm/AESEnricher.java @@ -28,11 +28,10 @@ import com.ibm.mapper.model.algorithms.AES; import com.ibm.mapper.model.mode.CCM; import com.ibm.mapper.model.mode.GCM; -import org.jetbrains.annotations.NotNull; - +import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Map; +import org.jetbrains.annotations.NotNull; public class AESEnricher implements IEnricher { private static final String BASE_OID = "2.16.840.1.101.3.4.1"; @@ -67,12 +66,13 @@ private INode enrich(@NotNull AES aes) { @Nullable final Mode mode = aes.getMode().orElse(null); // default key length if (keyLength == null) { - switch (aes.getDetectionContext().bundle().getIdentifier()) { - case "Jca": { - keyLength = new KeyLength(128, aes.getDetectionContext()); - aes.append(keyLength); - } - } + switch (aes.getDetectionContext().bundle().getIdentifier()) { + case "Jca": + { + keyLength = new KeyLength(128, aes.getDetectionContext()); + aes.append(keyLength); + } + } } // add oid final Oid oid = new Oid(buildOid(keyLength, mode), aes.getDetectionContext()); diff --git a/enricher/src/test/java/com/ibm/enricher/algorithm/AESEnricherTest.java b/enricher/src/test/java/com/ibm/enricher/algorithm/AESEnricherTest.java index b54af481..5b0f6cb5 100644 --- a/enricher/src/test/java/com/ibm/enricher/algorithm/AESEnricherTest.java +++ b/enricher/src/test/java/com/ibm/enricher/algorithm/AESEnricherTest.java @@ -19,6 +19,8 @@ */ package com.ibm.enricher.algorithm; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.enricher.TestBase; import com.ibm.mapper.model.AuthenticatedEncryption; import com.ibm.mapper.model.BlockCipher; @@ -29,11 +31,8 @@ import com.ibm.mapper.model.mode.GCM; import com.ibm.mapper.model.padding.PKCS1; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class AESEnricherTest extends TestBase { @@ -41,11 +40,7 @@ class AESEnricherTest extends TestBase { void oid() { DetectionLocation testDetectionLocation = new DetectionLocation("testfile", 1, 1, List.of("test"), () -> "SSL"); - final AES aes = - new AES( - 256, - new ECB(testDetectionLocation), - testDetectionLocation); + final AES aes = new AES(256, new ECB(testDetectionLocation), testDetectionLocation); this.logBefore(aes); final AESEnricher aesEnricher = new AESEnricher(); diff --git a/java/src/main/java/com/ibm/plugin/translation/JavaTranslationProcess.java b/java/src/main/java/com/ibm/plugin/translation/JavaTranslationProcess.java index 2e9fbff1..7bda2c39 100644 --- a/java/src/main/java/com/ibm/plugin/translation/JavaTranslationProcess.java +++ b/java/src/main/java/com/ibm/plugin/translation/JavaTranslationProcess.java @@ -27,17 +27,16 @@ import com.ibm.mapper.reorganizer.Reorganizer; import com.ibm.mapper.utils.Utils; import com.ibm.plugin.translation.translator.JavaTranslator; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nonnull; import org.jetbrains.annotations.Unmodifiable; import org.sonar.plugins.java.api.JavaCheck; import org.sonar.plugins.java.api.JavaFileScannerContext; import org.sonar.plugins.java.api.semantic.Symbol; import org.sonar.plugins.java.api.tree.Tree; -import javax.annotation.Nonnull; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - public final class JavaTranslationProcess extends ITranslationProcess { diff --git a/java/src/main/java/com/ibm/plugin/translation/translator/JavaTranslator.java b/java/src/main/java/com/ibm/plugin/translation/translator/JavaTranslator.java index 276ba035..b8d459a6 100644 --- a/java/src/main/java/com/ibm/plugin/translation/translator/JavaTranslator.java +++ b/java/src/main/java/com/ibm/plugin/translation/translator/JavaTranslator.java @@ -48,6 +48,13 @@ import com.ibm.plugin.translation.translator.contexts.JavaProtocolContextTranslator; import com.ibm.plugin.translation.translator.contexts.JavaSecretKeyContextTranslator; import com.ibm.plugin.translation.translator.contexts.JavaSignatureContextTranslator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.jetbrains.annotations.Unmodifiable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,14 +69,6 @@ import org.sonar.plugins.java.api.tree.SyntaxToken; import org.sonar.plugins.java.api.tree.Tree; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - public final class JavaTranslator extends ITranslator { diff --git a/mapper/src/main/java/com/ibm/mapper/ITranslator.java b/mapper/src/main/java/com/ibm/mapper/ITranslator.java index f5ab2688..95b4e862 100644 --- a/mapper/src/main/java/com/ibm/mapper/ITranslator.java +++ b/mapper/src/main/java/com/ibm/mapper/ITranslator.java @@ -25,11 +25,10 @@ import com.ibm.engine.rule.IBundle; import com.ibm.mapper.model.INode; import com.ibm.mapper.utils.DetectionLocation; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public abstract class ITranslator { @@ -47,5 +46,5 @@ protected abstract Optional translate( @Nonnull final String filePath); @Nullable protected abstract DetectionLocation getDetectionContextFrom( - @Nonnull T location, @Nonnull final IBundle bundle, @Nonnull String filePath); + @Nonnull T location, @Nonnull final IBundle bundle, @Nonnull String filePath); } diff --git a/mapper/src/main/java/com/ibm/mapper/mapper/jca/JcaPaddingMapper.java b/mapper/src/main/java/com/ibm/mapper/mapper/jca/JcaPaddingMapper.java index 79311ba5..c92eb565 100644 --- a/mapper/src/main/java/com/ibm/mapper/mapper/jca/JcaPaddingMapper.java +++ b/mapper/src/main/java/com/ibm/mapper/mapper/jca/JcaPaddingMapper.java @@ -25,10 +25,9 @@ import com.ibm.mapper.model.padding.PKCS1; import com.ibm.mapper.model.padding.PKCS5; import com.ibm.mapper.utils.DetectionLocation; - +import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Optional; public class JcaPaddingMapper implements IMapper { diff --git a/mapper/src/main/java/com/ibm/mapper/model/Cipher.java b/mapper/src/main/java/com/ibm/mapper/model/Cipher.java index e29b38bc..48705f46 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/Cipher.java +++ b/mapper/src/main/java/com/ibm/mapper/model/Cipher.java @@ -19,8 +19,8 @@ */ package com.ibm.mapper.model; -import javax.annotation.Nonnull; import java.util.Optional; +import javax.annotation.Nonnull; public class Cipher extends Algorithm implements ICipher, AuthenticatedEncryption { diff --git a/mapper/src/main/java/com/ibm/mapper/model/MessageDigest.java b/mapper/src/main/java/com/ibm/mapper/model/MessageDigest.java index 4cb738d4..d0603ae7 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/MessageDigest.java +++ b/mapper/src/main/java/com/ibm/mapper/model/MessageDigest.java @@ -19,16 +19,15 @@ */ package com.ibm.mapper.model; -import javax.annotation.Nonnull; import java.util.Optional; +import javax.annotation.Nonnull; public class MessageDigest extends Algorithm { public MessageDigest(@Nonnull Algorithm algorithm) { super(algorithm, MessageDigest.class); } - public MessageDigest(@Nonnull Algorithm algorithm, - @Nonnull DigestSize digestSize) { + public MessageDigest(@Nonnull Algorithm algorithm, @Nonnull DigestSize digestSize) { super(algorithm, MessageDigest.class); this.append(digestSize); } diff --git a/mapper/src/main/java/com/ibm/mapper/model/Padding.java b/mapper/src/main/java/com/ibm/mapper/model/Padding.java index fb917c8e..4f5bc038 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/Padding.java +++ b/mapper/src/main/java/com/ibm/mapper/model/Padding.java @@ -20,10 +20,9 @@ package com.ibm.mapper.model; import com.ibm.mapper.utils.DetectionLocation; - -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Objects; +import javax.annotation.Nonnull; public class Padding extends Property { @Nonnull private final String name; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/AES.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/AES.java index 5f484aa5..4d038059 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/AES.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/AES.java @@ -27,9 +27,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class AES extends BlockCipher { private static final String NAME = "AES"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/AESWrap.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/AESWrap.java index 781dc1c8..72b992e6 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/AESWrap.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/AESWrap.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class AESWrap extends BlockCipher { private static final String NAME = "AESWrap"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Aria.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Aria.java index bd001b6b..01d7715d 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Aria.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Aria.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class Aria extends BlockCipher { private static final String NAME = "Aria"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Blowfish.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Blowfish.java index 23494e6e..5c11a0f1 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Blowfish.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Blowfish.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class Blowfish extends BlockCipher { private static final String NAME = "Blowfish"; @@ -43,9 +42,7 @@ public Blowfish(int keyLength, @NotNull DetectionLocation detectionLocation) { } public Blowfish( - int keyLength, - @Nonnull Mode mode, - @NotNull DetectionLocation detectionLocation) { + int keyLength, @Nonnull Mode mode, @NotNull DetectionLocation detectionLocation) { super(new Algorithm(NAME, detectionLocation)); this.append(new KeyLength(keyLength, detectionLocation)); this.append(mode); diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Camellia.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Camellia.java index ce3f00c9..0686e56f 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/Camellia.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/Camellia.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class Camellia extends BlockCipher { private static final String NAME = "Camellia"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/ChaCha20.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/ChaCha20.java index a53d680f..af6e1225 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/ChaCha20.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/ChaCha20.java @@ -25,9 +25,8 @@ import com.ibm.mapper.model.Padding; import com.ibm.mapper.model.StreamCipher; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class ChaCha20 extends StreamCipher { private static final String NAME = "ChaCha20"; @@ -42,9 +41,7 @@ public ChaCha20(int keyLength, @NotNull DetectionLocation detectionLocation) { } public ChaCha20( - int keyLength, - @Nonnull Padding padding, - @NotNull DetectionLocation detectionLocation) { + int keyLength, @Nonnull Padding padding, @NotNull DetectionLocation detectionLocation) { super(new Algorithm(NAME, detectionLocation)); this.append(new KeyLength(keyLength, detectionLocation)); this.append(padding); diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/DES.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/DES.java index 39ae775a..907e0b2b 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/DES.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/DES.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class DES extends BlockCipher { private static final String NAME = "DES"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/DESedeWrap.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/DESedeWrap.java index 81121980..26e4c48c 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/DESedeWrap.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/DESedeWrap.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class DESedeWrap extends BlockCipher { private static final String NAME = "DESedeWrap"; // TripleDESWrap @@ -43,9 +42,7 @@ public DESedeWrap(int keyLength, @NotNull DetectionLocation detectionLocation) { } public DESedeWrap( - int keyLength, - @Nonnull Mode mode, - @NotNull DetectionLocation detectionLocation) { + int keyLength, @Nonnull Mode mode, @NotNull DetectionLocation detectionLocation) { super(new Algorithm(NAME, detectionLocation)); this.append(new KeyLength(keyLength, detectionLocation)); this.append(mode); diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC2.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC2.java index 6cc3afc6..091fc86b 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC2.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC2.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class RC2 extends BlockCipher { private static final String NAME = "RC2"; // ARC2 diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC4.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC4.java index 2502c7e3..91267b64 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC4.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC4.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Padding; import com.ibm.mapper.model.StreamCipher; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class RC4 extends StreamCipher { private static final String NAME = "RC4"; // ARC4, ARCFOUR diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC5.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC5.java index 8bbaf88b..20d9f254 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC5.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/RC5.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class RC5 extends BlockCipher { private static final String NAME = "RC5"; // ARC2 @@ -42,10 +41,7 @@ public RC5(int keyLength, @NotNull DetectionLocation detectionLocation) { this.append(new KeyLength(keyLength, detectionLocation)); } - public RC5( - int keyLength, - @Nonnull Mode mode, - @NotNull DetectionLocation detectionLocation) { + public RC5(int keyLength, @Nonnull Mode mode, @NotNull DetectionLocation detectionLocation) { super(new Algorithm(NAME, detectionLocation)); this.append(new KeyLength(keyLength, detectionLocation)); this.append(mode); diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/SEED.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/SEED.java index 33e745d8..3e281024 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/SEED.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/SEED.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public final class SEED extends BlockCipher { private static final String NAME = "SEED"; diff --git a/mapper/src/main/java/com/ibm/mapper/model/algorithms/TripleDES.java b/mapper/src/main/java/com/ibm/mapper/model/algorithms/TripleDES.java index a4a0c282..cdb10a10 100644 --- a/mapper/src/main/java/com/ibm/mapper/model/algorithms/TripleDES.java +++ b/mapper/src/main/java/com/ibm/mapper/model/algorithms/TripleDES.java @@ -26,9 +26,8 @@ import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.Padding; import com.ibm.mapper.utils.DetectionLocation; -import org.jetbrains.annotations.NotNull; - import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; // default is EDE mode public final class TripleDES extends BlockCipher { diff --git a/mapper/src/main/java/com/ibm/mapper/utils/DetectionLocation.java b/mapper/src/main/java/com/ibm/mapper/utils/DetectionLocation.java index 1966a75b..7108abfb 100644 --- a/mapper/src/main/java/com/ibm/mapper/utils/DetectionLocation.java +++ b/mapper/src/main/java/com/ibm/mapper/utils/DetectionLocation.java @@ -20,9 +20,8 @@ package com.ibm.mapper.utils; import com.ibm.engine.rule.IBundle; - -import javax.annotation.Nonnull; import java.util.List; +import javax.annotation.Nonnull; public record DetectionLocation( @Nonnull String filePath, diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaAlgorithmMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaAlgorithmMapperTest.java index a4b3b061..539518b2 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaAlgorithmMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaAlgorithmMapperTest.java @@ -19,6 +19,8 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.AuthenticatedEncryption; import com.ibm.mapper.model.BlockCipher; import com.ibm.mapper.model.HMAC; @@ -31,12 +33,9 @@ import com.ibm.mapper.model.Signature; import com.ibm.mapper.model.StreamCipher; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaAlgorithmMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaCipherMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaCipherMapperTest.java index 7a4ec3ff..12b9a8a8 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaCipherMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaCipherMapperTest.java @@ -19,6 +19,8 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.model.BlockCipher; import com.ibm.mapper.model.Cipher; @@ -32,12 +34,9 @@ import com.ibm.mapper.model.mode.CFB; import com.ibm.mapper.model.mode.ECB; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaCipherMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaHMACMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaHMACMapperTest.java index 2d5a4db2..8a67cbe6 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaHMACMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaHMACMapperTest.java @@ -19,6 +19,8 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.model.HMAC; import com.ibm.mapper.model.INode; @@ -26,13 +28,10 @@ import com.ibm.mapper.model.PasswordBasedEncryption; import com.ibm.mapper.model.algorithms.SHA2; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Map; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaHMACMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaKeyAgreementMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaKeyAgreementMapperTest.java index 8d4756db..19f61ccc 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaKeyAgreementMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaKeyAgreementMapperTest.java @@ -19,15 +19,14 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.KeyAgreement; import com.ibm.mapper.model.algorithms.x448; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaKeyAgreementMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaMessageDigestMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaMessageDigestMapperTest.java index c3a946b7..17f5c504 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaMessageDigestMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaMessageDigestMapperTest.java @@ -19,16 +19,15 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.INode; import com.ibm.mapper.model.MessageDigest; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Map; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaMessageDigestMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaModeMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaModeMapperTest.java index 9e6f268d..4dc896ad 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaModeMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaModeMapperTest.java @@ -19,16 +19,15 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.Mode; import com.ibm.mapper.model.mode.CCM; import com.ibm.mapper.model.mode.OFB; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaModeMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaOAEPPaddingMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaOAEPPaddingMapperTest.java index 14895a69..bcde324f 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaOAEPPaddingMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaOAEPPaddingMapperTest.java @@ -19,18 +19,17 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.MaskGenerationFunction; import com.ibm.mapper.model.MessageDigest; import com.ibm.mapper.model.algorithms.MD5; import com.ibm.mapper.model.algorithms.MGF1; import com.ibm.mapper.model.padding.OAEP; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaOAEPPaddingMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPRNGMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPRNGMapperTest.java index 6a52a7bd..4ce53bdf 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPRNGMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPRNGMapperTest.java @@ -19,14 +19,13 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.PseudorandomNumberGenerator; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaPRNGMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPaddingMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPaddingMapperTest.java index d0b06537..ce250e50 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPaddingMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaPaddingMapperTest.java @@ -19,16 +19,15 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.INode; import com.ibm.mapper.model.padding.OAEP; import com.ibm.mapper.model.padding.PKCS1; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaPaddingMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaSignatureMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaSignatureMapperTest.java index a103ed93..085d6710 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaSignatureMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/jca/JcaSignatureMapperTest.java @@ -19,6 +19,8 @@ */ package com.ibm.mapper.mapper.jca; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.MessageDigest; import com.ibm.mapper.model.Signature; import com.ibm.mapper.model.algorithms.DSA; @@ -28,12 +30,9 @@ import com.ibm.mapper.model.algorithms.SHA2; import com.ibm.mapper.model.algorithms.SHA3; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; class JcaSignatureMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/ssl/CipherSuiteMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/ssl/CipherSuiteMapperTest.java index 8f681f65..21ea525c 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/ssl/CipherSuiteMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/ssl/CipherSuiteMapperTest.java @@ -19,6 +19,8 @@ */ package com.ibm.mapper.mapper.ssl; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.CipherSuite; import com.ibm.mapper.model.INode; import com.ibm.mapper.model.Identifier; @@ -28,12 +30,9 @@ import com.ibm.mapper.model.algorithms.DSA; import com.ibm.mapper.model.algorithms.SHA2; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; public class CipherSuiteMapperTest { diff --git a/mapper/src/test/java/com/ibm/mapper/mapper/ssl/SSLVersionMapperTest.java b/mapper/src/test/java/com/ibm/mapper/mapper/ssl/SSLVersionMapperTest.java index f150ee34..dfaa3b6f 100644 --- a/mapper/src/test/java/com/ibm/mapper/mapper/ssl/SSLVersionMapperTest.java +++ b/mapper/src/test/java/com/ibm/mapper/mapper/ssl/SSLVersionMapperTest.java @@ -19,15 +19,14 @@ */ package com.ibm.mapper.mapper.ssl; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.INode; import com.ibm.mapper.model.Version; import com.ibm.mapper.utils.DetectionLocation; -import org.junit.Test; - import java.util.List; import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; public class SSLVersionMapperTest { diff --git a/output/src/test/java/com/ibm/output/cyclonedx/AlgorithmTest.java b/output/src/test/java/com/ibm/output/cyclonedx/AlgorithmTest.java index 62d597c9..f39cf509 100644 --- a/output/src/test/java/com/ibm/output/cyclonedx/AlgorithmTest.java +++ b/output/src/test/java/com/ibm/output/cyclonedx/AlgorithmTest.java @@ -19,6 +19,8 @@ */ package com.ibm.output.cyclonedx; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.mapper.jca.JcaAlgorithmMapper; import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.model.INode; @@ -30,6 +32,9 @@ import com.ibm.mapper.model.functionality.KeyGeneration; import com.ibm.mapper.utils.DetectionLocation; import com.ibm.output.cyclondx.CBOMOutputFile; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import org.cyclonedx.model.Bom; import org.cyclonedx.model.Component; import org.cyclonedx.model.component.crypto.AlgorithmProperties; @@ -39,12 +44,6 @@ import org.cyclonedx.model.component.evidence.Occurrence; import org.junit.jupiter.api.Test; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; - class AlgorithmTest { private final String filePath = "test.java"; diff --git a/output/src/test/java/com/ibm/output/cyclonedx/MergeDetectionLocationTest.java b/output/src/test/java/com/ibm/output/cyclonedx/MergeDetectionLocationTest.java index 65a39a89..10147cbf 100644 --- a/output/src/test/java/com/ibm/output/cyclonedx/MergeDetectionLocationTest.java +++ b/output/src/test/java/com/ibm/output/cyclonedx/MergeDetectionLocationTest.java @@ -19,20 +19,19 @@ */ package com.ibm.output.cyclonedx; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.utils.DetectionLocation; import com.ibm.output.cyclondx.CBOMOutputFile; +import java.util.Collections; +import java.util.List; import org.cyclonedx.model.Bom; import org.cyclonedx.model.Component; import org.cyclonedx.model.component.crypto.CryptoProperties; import org.cyclonedx.model.component.crypto.enums.AssetType; import org.junit.jupiter.api.Test; -import java.util.Collections; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - class MergeDetectionLocationTest { @Test @@ -44,7 +43,8 @@ void differentContexts() { Algorithm algorithm = new Algorithm("RSA", detectionLocation); outputFile.add(List.of(algorithm)); // asset 2 - detectionLocation = new DetectionLocation("test2.java", 2, 2, Collections.emptyList(), () -> "SSL"); + detectionLocation = + new DetectionLocation("test2.java", 2, 2, Collections.emptyList(), () -> "SSL"); algorithm = new Algorithm("RSA", detectionLocation); outputFile.add(List.of(algorithm)); @@ -73,7 +73,8 @@ void sameContexts() { Algorithm algorithm = new Algorithm("RSA", detectionLocation); outputFile.add(List.of(algorithm)); // asset 2 - detectionLocation = new DetectionLocation("test1.java", 1, 1, Collections.emptyList(), () -> "SSL"); + detectionLocation = + new DetectionLocation("test1.java", 1, 1, Collections.emptyList(), () -> "SSL"); algorithm = new Algorithm("RSA", detectionLocation); outputFile.add(List.of(algorithm));