1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package tests.security.interfaces; 17 18 import junit.framework.TestCase; 19 20 import java.math.BigInteger; 21 import java.security.interfaces.DSAParams; 22 import java.security.spec.DSAParameterSpec; 23 24 public class DSAParamsTest extends TestCase { 25 26 private final BigInteger p = new BigInteger("4"); 27 private final BigInteger q = BigInteger.TEN; 28 private final BigInteger g = BigInteger.ZERO; 29 30 /** 31 * java.security.interfaces.DSAParams 32 * #getG() 33 */ test_getG()34 public void test_getG() { 35 DSAParams params = new DSAParameterSpec(p, q, g); 36 assertEquals("Invalid G", g, params.getG()); 37 } 38 39 /** 40 * java.security.interfaces.DSAParams 41 * #getP() 42 */ test_getP()43 public void test_getP() { 44 DSAParams params = new DSAParameterSpec(p, q, g); 45 assertEquals("Invalid P", p, params.getP()); 46 } 47 48 /** 49 * java.security.interfaces.DSAParams 50 * #getQ() 51 */ test_getQ()52 public void test_getQ() { 53 DSAParams params = new DSAParameterSpec(p, q, g); 54 assertEquals("Invalid Q", q, params.getQ()); 55 } 56 } 57