1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * @author Vladimir N. Molotkov 20 * @version $Revision$ 21 */ 22 23 package tests.security.spec; 24 25 import junit.framework.TestCase; 26 27 import java.math.BigInteger; 28 import java.security.spec.AlgorithmParameterSpec; 29 import java.security.spec.DSAParameterSpec; 30 31 /** 32 * Tests for <code>DSAParameterSpec</code> 33 * 34 */ 35 public class DSAParameterSpecTest extends TestCase { 36 37 /** 38 * Ctor test 39 */ 40 public final void testDSAParameterSpec() { 41 AlgorithmParameterSpec aps = new DSAParameterSpec( 42 new BigInteger("1"), 43 new BigInteger("2"), 44 new BigInteger("3")); 45 46 assertTrue(aps instanceof DSAParameterSpec); 47 } 48 49 /** 50 * getG() test 51 */ 52 public final void testGetG() { 53 DSAParameterSpec dps = new DSAParameterSpec( 54 new BigInteger("1"), 55 new BigInteger("2"), 56 new BigInteger("3")); 57 58 assertEquals(3, dps.getG().intValue()); 59 } 60 61 /** 62 * getP() test 63 */ 64 public final void testGetP() { 65 DSAParameterSpec dps = new DSAParameterSpec( 66 new BigInteger("1"), 67 new BigInteger("2"), 68 new BigInteger("3")); 69 70 assertEquals(1, dps.getP().intValue()); 71 } 72 73 /** 74 * getQ() test 75 */ 76 public final void testGetQ() { 77 DSAParameterSpec dps = new DSAParameterSpec( 78 new BigInteger("1"), 79 new BigInteger("2"), 80 new BigInteger("3")); 81 82 assertEquals(2, dps.getQ().intValue()); 83 } 84 } 85