Reformat PolicyEngineAPI test cases
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / TestRunner.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (C) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.test;
24
25 import org.junit.runner.JUnitCore;
26 import org.junit.runner.Result;
27 import org.junit.runner.notification.Failure;
28
29 public class TestRunner {
30     public static void main(String[] args) {
31         Result result = JUnitCore.runClasses(PolicyEngineTest.class);
32         for (Failure failure : result.getFailures()) {
33             System.out.println("Failed Test: " + failure.toString());
34         }
35         Result results = null;
36         if (result.wasSuccessful()) {
37             System.out.println("API Methods are being Tested.. ");
38             results = JUnitCore.runClasses(GetConfigByPolicyNameTest.class,
39                     GetConfigStringTest.class, GetConfigStringStringTest.class,
40                     GetConfigStringStringMapTest.class, SendEventTest.class);
41             for (Failure failure : results.getFailures()) {
42                 System.out.println("Failed Test: " + failure.toString());
43             }
44             System.out.println("Test Results.. ");
45             System.out.println("Stats:  \nRun Time: " + (results.getRunTime() + result.getRunTime())
46                     + "\nTotal Tests:" + results.getRunCount() + result.getRunCount()
47                     + "\nFailures: " + results.getFailureCount() + result.getFailureCount());
48             System.exit(1);
49         }
50         System.out.println("Test Failed..");
51         System.out.println("Stats:  \nRun Time: " + result.getRunTime() + "\nTests:"
52                 + result.getRunCount() + "\nFailures: " + result.getFailureCount());
53     }
54 }