OOXMLLite: improve progress output: count test-classes, not single test-methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1829641 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2018-04-20 09:46:47 +00:00
parent 2d7fdbc4bc
commit bc436fcc3d

View File

@ -29,8 +29,10 @@ import java.security.ProtectionDomain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.Vector; import java.util.Vector;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
@ -165,18 +167,23 @@ public final class OOXMLLite {
//run tests //run tests
JUnitCore jUnitCore = new JUnitCore(); JUnitCore jUnitCore = new JUnitCore();
jUnitCore.addListener(new TextListener(System.out) { jUnitCore.addListener(new TextListener(System.out) {
private final Set<String> classes = new HashSet<>();
private int count; private int count;
@Override @Override
public void testStarted(Description description) { public void testStarted(Description description) {
// count how many test-classes we already saw
classes.add(description.getClassName());
count++; count++;
if(count % 100 == 0) { if(count % 100 == 0) {
System.out.println(); System.out.println();
System.out.println(count + "/" + lst.size() + ": " + description.getDisplayName()); System.out.println(classes.size() + "/" + lst.size() + ": " + description.getDisplayName());
} }
super.testStarted(description); super.testStarted(description);
} }
}); });
Result result = jUnitCore.run(lst.toArray(new Class<?>[lst.size()])); Result result = jUnitCore.run(lst.toArray(new Class<?>[0]));
if (!result.wasSuccessful()) { if (!result.wasSuccessful()) {
throw new RuntimeException("Tests did not succeed, cannot build ooxml-lite jar"); throw new RuntimeException("Tests did not succeed, cannot build ooxml-lite jar");
} }