CertPathBuilderSpiTest.java revision 561ee011997c6c2f1befbfaa9d5f0a99771c1d63
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 Vera Y. Petrashkova
20*/
21
22package org.apache.harmony.security.tests.java.security.cert;
23
24import java.security.InvalidAlgorithmParameterException;
25import java.security.cert.CertPathBuilderException;
26import java.security.cert.CertPathBuilderResult;
27import java.security.cert.CertPathBuilderSpi;
28import java.security.cert.CertPathParameters;
29
30import org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi;
31
32import junit.framework.TestCase;
33
34/**
35 * Tests for <code>CertPathBuilderSpi</code> class constructors and methods.
36 *
37 */
38
39public class CertPathBuilderSpiTest extends TestCase {
40
41    /**
42     * Constructor for CertPathBuilderSpiTest.
43     *
44     * @param arg0
45     */
46    public CertPathBuilderSpiTest(String arg0) {
47        super(arg0);
48    }
49
50    /**
51     * Test for <code>CertPathBuilderSpi</code> constructor Assertion:
52     * constructs CertPathBuilderSpi
53     */
54    public void testCertPathBuilderSpi01() throws CertPathBuilderException,
55            InvalidAlgorithmParameterException {
56        CertPathBuilderSpi certPathBuilder = new MyCertPathBuilderSpi();
57        CertPathParameters cpp = null;
58        try {
59            certPathBuilder.engineBuild(cpp);
60            fail("CertPathBuilderException must be thrown");
61        } catch (CertPathBuilderException e) {
62        }
63        CertPathBuilderResult cpbResult = certPathBuilder.engineBuild(cpp);
64        assertNull("Not null CertPathBuilderResult", cpbResult);
65    }
66}