MultipleTestTracker.java
net.minecraft.gametest.framework.MultipleTestTracker
信息
- 全限定名:net.minecraft.gametest.framework.MultipleTestTracker
- 类型:public class
- 包:net.minecraft.gametest.framework
- 源码路径:src/main/java/net/minecraft/gametest/framework/MultipleTestTracker.java
- 起始行号:L9
- 职责:
TODO
字段/常量
-
NOT_STARTED_TEST_CHAR- 类型:
char - 修饰符:
private static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
ONGOING_TEST_CHAR- 类型:
char - 修饰符:
private static final - 源码定位:
L11 - 说明:
TODO
- 类型:
-
SUCCESSFUL_TEST_CHAR- 类型:
char - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
FAILED_OPTIONAL_TEST_CHAR- 类型:
char - 修饰符:
private static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
FAILED_REQUIRED_TEST_CHAR- 类型:
char - 修饰符:
private static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
tests- 类型:
Collection<GameTestInfo> - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
listeners- 类型:
Collection<GameTestListener> - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public MultipleTestTracker() @ L18
- 构造器名:MultipleTestTracker
- 源码定位:L18
- 修饰符:public
参数:
- 无
说明:
TODO
public MultipleTestTracker(Collection<GameTestInfo> tests) @ L21
- 构造器名:MultipleTestTracker
- 源码定位:L21
- 修饰符:public
参数:
- tests: Collection
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void addTestToTrack(GameTestInfo testInfo) @ L25
- 方法名:addTestToTrack
- 源码定位:L25
- 返回类型:void
- 修饰符:public
参数:
- testInfo: GameTestInfo
说明:
TODO
public void addListener(GameTestListener listener) @ L30
- 方法名:addListener
- 源码定位:L30
- 返回类型:void
- 修饰符:public
参数:
- listener: GameTestListener
说明:
TODO
public void addFailureListener(Consumer<GameTestInfo> listener) @ L35
- 方法名:addFailureListener
- 源码定位:L35
- 返回类型:void
- 修饰符:public
参数:
- listener: Consumer
说明:
TODO
public int getFailedRequiredCount() @ L60
- 方法名:getFailedRequiredCount
- 源码定位:L60
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getFailedOptionalCount() @ L64
- 方法名:getFailedOptionalCount
- 源码定位:L64
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public int getDoneCount() @ L68
- 方法名:getDoneCount
- 源码定位:L68
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean hasFailedRequired() @ L72
- 方法名:hasFailedRequired
- 源码定位:L72
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean hasFailedOptional() @ L76
- 方法名:hasFailedOptional
- 源码定位:L76
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public Collection<GameTestInfo> getFailedRequired() @ L80
- 方法名:getFailedRequired
- 源码定位:L80
- 返回类型:Collection
- 修饰符:public
参数:
- 无
说明:
TODO
public Collection<GameTestInfo> getFailedOptional() @ L84
- 方法名:getFailedOptional
- 源码定位:L84
- 返回类型:Collection
- 修饰符:public
参数:
- 无
说明:
TODO
public int getTotalCount() @ L88
- 方法名:getTotalCount
- 源码定位:L88
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean isDone() @ L92
- 方法名:isDone
- 源码定位:L92
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public String getProgressBar() @ L96
- 方法名:getProgressBar
- 源码定位:L96
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
public String toString() @ L114
- 方法名:toString
- 源码定位:L114
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
public void remove(GameTestInfo testInfo) @ L119
- 方法名:remove
- 源码定位:L119
- 返回类型:void
- 修饰符:public
参数:
- testInfo: GameTestInfo
说明:
TODO
代码
public class MultipleTestTracker {
private static final char NOT_STARTED_TEST_CHAR = ' ';
private static final char ONGOING_TEST_CHAR = '_';
private static final char SUCCESSFUL_TEST_CHAR = '+';
private static final char FAILED_OPTIONAL_TEST_CHAR = 'x';
private static final char FAILED_REQUIRED_TEST_CHAR = 'X';
private final Collection<GameTestInfo> tests = Lists.newArrayList();
private final Collection<GameTestListener> listeners = Lists.newArrayList();
public MultipleTestTracker() {
}
public MultipleTestTracker(Collection<GameTestInfo> tests) {
this.tests.addAll(tests);
}
public void addTestToTrack(GameTestInfo testInfo) {
this.tests.add(testInfo);
this.listeners.forEach(testInfo::addListener);
}
public void addListener(GameTestListener listener) {
this.listeners.add(listener);
this.tests.forEach(testInfo -> testInfo.addListener(listener));
}
public void addFailureListener(Consumer<GameTestInfo> listener) {
this.addListener(new GameTestListener() {
{
Objects.requireNonNull(MultipleTestTracker.this);
}
@Override
public void testStructureLoaded(GameTestInfo testInfo) {
}
@Override
public void testPassed(GameTestInfo testInfo, GameTestRunner runner) {
}
@Override
public void testFailed(GameTestInfo testInfo, GameTestRunner runner) {
listener.accept(testInfo);
}
@Override
public void testAddedForRerun(GameTestInfo original, GameTestInfo copy, GameTestRunner runner) {
}
});
}
public int getFailedRequiredCount() {
return (int)this.tests.stream().filter(GameTestInfo::hasFailed).filter(GameTestInfo::isRequired).count();
}
public int getFailedOptionalCount() {
return (int)this.tests.stream().filter(GameTestInfo::hasFailed).filter(GameTestInfo::isOptional).count();
}
public int getDoneCount() {
return (int)this.tests.stream().filter(GameTestInfo::isDone).count();
}
public boolean hasFailedRequired() {
return this.getFailedRequiredCount() > 0;
}
public boolean hasFailedOptional() {
return this.getFailedOptionalCount() > 0;
}
public Collection<GameTestInfo> getFailedRequired() {
return this.tests.stream().filter(GameTestInfo::hasFailed).filter(GameTestInfo::isRequired).collect(Collectors.toList());
}
public Collection<GameTestInfo> getFailedOptional() {
return this.tests.stream().filter(GameTestInfo::hasFailed).filter(GameTestInfo::isOptional).collect(Collectors.toList());
}
public int getTotalCount() {
return this.tests.size();
}
public boolean isDone() {
return this.getDoneCount() == this.getTotalCount();
}
public String getProgressBar() {
StringBuffer buf = new StringBuffer();
buf.append('[');
this.tests.forEach(test -> {
if (!test.hasStarted()) {
buf.append(' ');
} else if (test.hasSucceeded()) {
buf.append('+');
} else if (test.hasFailed()) {
buf.append((char)(test.isRequired() ? 'X' : 'x'));
} else {
buf.append('_');
}
});
buf.append(']');
return buf.toString();
}
@Override
public String toString() {
return this.getProgressBar();
}
public void remove(GameTestInfo testInfo) {
this.tests.remove(testInfo);
}
}引用的其他类
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
参数/字段/构造调用 - 关联成员:
GameTestListener()
- 引用位置: