mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extracted method
This commit is contained in:
@@ -67,18 +67,21 @@ public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
Set<String> passedSuites = ContainerUtil.newHashSet();
|
||||
Set<String> otherSuites = ContainerUtil.newHashSet();
|
||||
|
||||
for (Map.Entry<String, TestStateStorage.Record> item : records.entrySet()) {
|
||||
String url = item.getKey();
|
||||
TestStateInfo.Magnitude magnitude = getMagnitude(item.getValue().magnitude);
|
||||
List<TestInfo> infos = getTestInfos(records.entrySet(), runner);
|
||||
|
||||
for (TestInfo info : infos) {
|
||||
String url = info.url;
|
||||
TestStateInfo.Magnitude magnitude = info.magnitude;
|
||||
if (magnitude == null) continue;
|
||||
|
||||
switch (magnitude) {
|
||||
case COMPLETE_INDEX:
|
||||
if (runner.isSuite(url)) {
|
||||
if (info.isSuite) {
|
||||
passedSuites.add(url);
|
||||
}
|
||||
break;
|
||||
case PASSED_INDEX:
|
||||
if (runner.isSuite(url)) {
|
||||
if (info.isSuite) {
|
||||
passedSuites.add(url);
|
||||
}
|
||||
break;
|
||||
@@ -94,6 +97,19 @@ public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
return new TestGroup(failedTests, passedSuites, otherSuites);
|
||||
}
|
||||
|
||||
private static List<TestInfo> getTestInfos(Set<Map.Entry<String, TestStateStorage.Record>> entries, RecentTestRunner runner) {
|
||||
List<TestInfo> list = ContainerUtil.newSmartList();
|
||||
|
||||
for (Map.Entry<String, TestStateStorage.Record> item : entries) {
|
||||
String url = item.getKey();
|
||||
TestStateStorage.Record record = item.getValue();
|
||||
TestStateInfo.Magnitude magnitude = getMagnitude(record.magnitude);
|
||||
list.add(new TestInfo(url, magnitude, runner.isSuite(url)));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static TestStateInfo.Magnitude getMagnitude(int magnitude) {
|
||||
for (TestStateInfo.Magnitude m : TestStateInfo.Magnitude.values()) {
|
||||
if (m.getValue() == magnitude) {
|
||||
@@ -139,4 +155,17 @@ public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
this.otherTests = otherTests;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TestInfo {
|
||||
private final boolean isSuite;
|
||||
public String url;
|
||||
public TestStateInfo.Magnitude magnitude;
|
||||
|
||||
public TestInfo(String url, TestStateInfo.Magnitude magnitude, boolean isSuite) {
|
||||
this.url = url;
|
||||
this.magnitude = magnitude;
|
||||
this.isSuite = isSuite;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user