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 23package tests.security.spec; 24 25import dalvik.annotation.TestTargets; 26import dalvik.annotation.TestLevel; 27import dalvik.annotation.TestTargetNew; 28import dalvik.annotation.TestTargetClass; 29 30import junit.framework.TestCase; 31 32import java.math.BigInteger; 33import java.security.spec.AlgorithmParameterSpec; 34import java.security.spec.DSAParameterSpec; 35 36/** 37 * Tests for <code>DSAParameterSpec</code> 38 * 39 */ 40@TestTargetClass(DSAParameterSpec.class) 41public class DSAParameterSpecTest extends TestCase { 42 43 /** 44 * Ctor test 45 */ 46 @TestTargetNew( 47 level = TestLevel.COMPLETE, 48 notes = "", 49 method = "DSAParameterSpec", 50 args = {java.math.BigInteger.class, java.math.BigInteger.class, java.math.BigInteger.class} 51 ) 52 public final void testDSAParameterSpec() { 53 AlgorithmParameterSpec aps = new DSAParameterSpec( 54 new BigInteger("1"), 55 new BigInteger("2"), 56 new BigInteger("3")); 57 58 assertTrue(aps instanceof DSAParameterSpec); 59 } 60 61 /** 62 * getG() test 63 */ 64 @TestTargetNew( 65 level = TestLevel.COMPLETE, 66 notes = "", 67 method = "getG", 68 args = {} 69 ) 70 public final void testGetG() { 71 DSAParameterSpec dps = new DSAParameterSpec( 72 new BigInteger("1"), 73 new BigInteger("2"), 74 new BigInteger("3")); 75 76 assertEquals(3, dps.getG().intValue()); 77 } 78 79 /** 80 * getP() test 81 */ 82 @TestTargetNew( 83 level = TestLevel.COMPLETE, 84 notes = "", 85 method = "getP", 86 args = {} 87 ) 88 public final void testGetP() { 89 DSAParameterSpec dps = new DSAParameterSpec( 90 new BigInteger("1"), 91 new BigInteger("2"), 92 new BigInteger("3")); 93 94 assertEquals(1, dps.getP().intValue()); 95 } 96 97 /** 98 * getQ() test 99 */ 100 @TestTargetNew( 101 level = TestLevel.COMPLETE, 102 notes = "", 103 method = "getQ", 104 args = {} 105 ) 106 public final void testGetQ() { 107 DSAParameterSpec dps = new DSAParameterSpec( 108 new BigInteger("1"), 109 new BigInteger("2"), 110 new BigInteger("3")); 111 112 assertEquals(2, dps.getQ().intValue()); 113 } 114} 115