Skip to content

Commit

Permalink
add test case for issue
Browse files Browse the repository at this point in the history
Signed-off-by: Nicklas Körtge <nicklas.koertge1@ibm.com>
  • Loading branch information
n1ckl0sk0rtge committed Sep 11, 2024
1 parent af7d128 commit 4dd7fe0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mapper/src/main/java/com/ibm/mapper/model/algorithms/RSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ public final class RSA extends Algorithm implements KeyAgreement, Signature, Pub
}

public RSA(@NotNull DetectionLocation detectionLocation) {
super(NAME, PublicKeyEncryption.class, detectionLocation);
this.put(new Oid(OID, detectionLocation));
this(PublicKeyEncryption.class, detectionLocation);
}

public RSA(int keyLength, @Nonnull DetectionLocation detectionLocation) {
super(NAME, PublicKeyEncryption.class, detectionLocation);
this(detectionLocation);
this.put(new KeyLength(keyLength, detectionLocation));
this.put(new Oid(OID, detectionLocation));
}

public RSA(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SonarQube Cryptography Plugin
* Copyright (C) 2024 IBM
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 com.ibm.mapper.mapper.issues;

import static org.assertj.core.api.Assertions.assertThat;

import com.ibm.mapper.model.INode;
import com.ibm.mapper.model.algorithms.RSA;
import com.ibm.mapper.utils.DetectionLocation;
import java.util.List;
import org.junit.Test;

public class Issue127Test {

@Test
public void test() {
final RSA rsa =
new RSA(2048, new DetectionLocation("test.java", 1, 1, List.of(), () -> "Test"));
final INode rsaCopy = rsa.deepCopy();
assertThat(rsaCopy).isInstanceOf(RSA.class);
}
}

0 comments on commit 4dd7fe0

Please sign in to comment.