2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.policy.controlloop.common.rules.test;
 
  23 import static org.junit.Assert.assertEquals;
 
  24 import static org.junit.Assert.fail;
 
  26 import org.junit.AfterClass;
 
  27 import org.junit.Ignore;
 
  28 import org.junit.Test;
 
  29 import org.junit.runner.RunWith;
 
  33  * Tests NamedRunner. The tests don't do much, because all we really want to check is
 
  34  * which tests are executed based on the {@link TestNames} annotation.
 
  36 @RunWith(NamedRunner.class)
 
  37 @TestNames(names = {"testAbc", "testDef", "testIgnore"}, prefixes = {"testGhi", "testJkl"})
 
  38 public class NamedRunnerTest {
 
  40     private static int testCount = 0;
 
  43     public static void tearDownAfterClass() {
 
  44         assertEquals(5, testCount);
 
  48     public void testAbc() {
 
  53     public void testAbc2() {
 
  54         fail("should not run");
 
  58     public void testDef() {
 
  63      * Note: this test is purposely marked with the "Ignore" annotation to verify that the
 
  64      * NamedRunner skips over it, hence the sonar issue is being suppressed.
 
  68     public void testIgnore() {      // NOSONAR
 
  69         fail("should not run");
 
  73     public void testGhi1() {
 
  78     public void testGhi2() {
 
  83     public void testJkl() {
 
  88     private static void checkTest() {