|
|
|
|
|
|
|
|
import junit.framework.TestCase; |
|
|
import junit.framework.TestCase; |
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
import org.junit.Test; |
|
|
|
|
|
import org.junit.internal.TextListener; |
|
|
import org.junit.runner.JUnitCore; |
|
|
import org.junit.runner.JUnitCore; |
|
|
import org.junit.runner.Result; |
|
|
import org.junit.runner.Result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void build() throws IOException, ClassNotFoundException { |
|
|
void build() throws IOException, ClassNotFoundException { |
|
|
|
|
|
|
|
|
List<Class<?>> lst = new ArrayList<Class<?>>(); |
|
|
List<Class<?>> lst = new ArrayList<Class<?>>(); |
|
|
//collect unit tests |
|
|
//collect unit tests |
|
|
System.out.println("Collecting unit tests from " + _testDir); |
|
|
System.out.println("Collecting unit tests from " + _testDir); |
|
|
|
|
|
|
|
|
System.out.println("Found " + lst.size() + " classes"); |
|
|
System.out.println("Found " + lst.size() + " classes"); |
|
|
|
|
|
|
|
|
//run tests |
|
|
//run tests |
|
|
Result result = JUnitCore.runClasses(lst.toArray(new Class<?>[lst.size()])); |
|
|
|
|
|
|
|
|
JUnitCore jUnitCore = new JUnitCore(); |
|
|
|
|
|
jUnitCore.addListener(new TextListener(System.out)); |
|
|
|
|
|
Result result = jUnitCore.run(lst.toArray(new Class<?>[lst.size()])); |
|
|
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"); |
|
|
} |
|
|
} |