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 18package org.apache.harmony.security.tests.java.security; 19 20import java.security.AlgorithmParametersSpi; 21import java.security.spec.AlgorithmParameterSpec; 22 23import junit.framework.TestCase; 24 25/** 26 * Tests for <code>AlgorithmParametersSpi</code> class constructors 27 * and methods. 28 * 29 */ 30public class AlgorithmParametersSpiTest extends TestCase { 31 32 33 /** 34 * Test for <code>AlgorithmParametersSpi</code> constructor 35 * Assertion: constructs AlgorithmParametersSpi 36 */ 37 public void testAlgorithmParametersSpi() { 38 byte[] bt = new byte[10]; 39 MyAlgorithmParametersSpi algParSpi = new MyAlgorithmParametersSpi(); 40 assertTrue(algParSpi instanceof AlgorithmParametersSpi); 41 assertNotNull(algParSpi); 42 43 algParSpi.engineInit(new MyAlgorithmParameterSpec()); 44 algParSpi.engineInit(bt); 45 algParSpi.engineInit(bt, "Format"); 46 algParSpi.engineToString(); 47 algParSpi.engineGetEncoded(); 48 algParSpi.engineGetEncoded("Format"); 49 algParSpi.engineGetParameterSpec(java.lang.Class.class); 50 } 51 52 public class MyAlgorithmParametersSpi extends AlgorithmParametersSpi { 53 protected void engineInit(AlgorithmParameterSpec paramSpec) { 54 } 55 protected void engineInit(byte[] params){ 56 } 57 protected void engineInit(byte[] params, String format){ 58 } 59 protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec){ 60 return null; 61 } 62 protected byte[] engineGetEncoded(){ 63 return null; 64 } 65 protected byte[] engineGetEncoded(String format){ 66 return null; 67 } 68 protected String engineToString() { 69 return null; 70 } 71 } 72 73 class MyAlgorithmParameterSpec implements AlgorithmParameterSpec {} 74} 75