1+ package org .bouncycastle .cert .test ;
2+
3+ import java .security .Security ;
4+
5+ import junit .extensions .TestSetup ;
6+ import junit .framework .Test ;
7+ import junit .framework .TestCase ;
8+ import junit .framework .TestSuite ;
9+ import org .bouncycastle .jce .provider .BouncyCastleProvider ;
10+ import org .bouncycastle .test .PrintTestResult ;
11+ import org .bouncycastle .util .test .SimpleTestResult ;
12+
13+ public class AllTests
14+ extends TestCase
15+ {
16+ public void setUp ()
17+ {
18+ if (Security .getProvider ("BC" ) == null )
19+ {
20+ Security .addProvider (new BouncyCastleProvider ());
21+ }
22+ }
23+
24+ public void testSimpleTests ()
25+ {
26+ org .bouncycastle .util .test .Test [] tests = new org .bouncycastle .util .test .Test []
27+ {
28+ new AttrCertSelectorTest (),
29+ new AttrCertTest (),
30+ new CertPathLoopTest (),
31+ new CertTest (),
32+ new DANETest (),
33+ new ExternalKeyTest (),
34+ new GOST3410_2012CMSTest (),
35+ new MLDSACredentialsTest (),
36+ new PKCS10Test (),
37+ new SLHDSACredentialsTest (),
38+ new X509ExtensionUtilsTest (),
39+ };
40+
41+ for (int i = 0 ; i != tests .length ; i ++)
42+ {
43+ SimpleTestResult result = (SimpleTestResult )tests [i ].perform ();
44+
45+ if (!result .isSuccessful ())
46+ {
47+ if (result .getException () != null )
48+ {
49+ result .getException ().printStackTrace ();
50+ }
51+ fail (result .toString ());
52+ }
53+ }
54+ }
55+
56+ public static void main (String [] args )
57+ {
58+ PrintTestResult .printResult (junit .textui .TestRunner .run (suite ()));
59+ }
60+
61+ public static Test suite ()
62+ {
63+ TestSuite suite = new TestSuite ("Cert Tests" );
64+
65+ if (Security .getProvider ("BC" ) == null )
66+ {
67+ Security .addProvider (new BouncyCastleProvider ());
68+ }
69+
70+ suite .addTestSuite (AllTests .class );
71+ suite .addTestSuite (BcAttrCertSelectorTest .class );
72+ suite .addTestSuite (BcAttrCertSelectorTest .class );
73+ suite .addTestSuite (BcAttrCertTest .class );
74+ suite .addTestSuite (BcCertTest .class );
75+ suite .addTestSuite (BcPKCS10Test .class );
76+ suite .addTestSuite (PQCPKCS10Test .class );
77+ suite .addTest (ConverterTest .suite ());
78+
79+ return new BCTestSetup (suite );
80+ }
81+
82+ static class BCTestSetup
83+ extends TestSetup
84+ {
85+ public BCTestSetup (Test test )
86+ {
87+ super (test );
88+ }
89+
90+ protected void setUp ()
91+ {
92+ Security .addProvider (new BouncyCastleProvider ());
93+ }
94+
95+ protected void tearDown ()
96+ {
97+ Security .removeProvider ("BC" );
98+ }
99+ }
100+
101+ }
0 commit comments