mirror of
https://github.com/google/guice.git
synced 2024-04-21 12:32:36 +00:00
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=324884430
46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
/*
|
|
* Copyright (C) 2011 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.google.inject;
|
|
|
|
import java.util.Enumeration;
|
|
import java.util.Set;
|
|
import junit.framework.Test;
|
|
import junit.framework.TestSuite;
|
|
|
|
public class SuiteUtils {
|
|
|
|
public static TestSuite removeSuppressedTests(TestSuite suite, Set<String> suppressedTestNames) {
|
|
TestSuite result = new TestSuite(suite.getName());
|
|
|
|
for (Enumeration<?> e = suite.tests(); e.hasMoreElements(); ) {
|
|
Test test = (Test) e.nextElement();
|
|
|
|
if (suppressedTestNames.contains(test.toString())) {
|
|
continue;
|
|
}
|
|
|
|
if (test instanceof TestSuite) {
|
|
result.addTest(removeSuppressedTests((TestSuite) test, suppressedTestNames));
|
|
} else {
|
|
result.addTest(test);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|