use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.
the class RetainedWithTest method createMapChildren.
@AutoreleasePool
private void createMapChildren(MapFactory factory, List<Integer> objectCodes) {
// Use separate maps for each of the views to ensure that each view type is strengthening its
// reference to the map.
Map m1 = factory.newMap();
Map m2 = factory.newMap();
Map m3 = factory.newMap();
ValueType v = new ValueType();
m1.put(factory.getKey(), v);
m2.put(factory.getKey(), v);
m3.put(factory.getKey(), v);
keys = m1.keySet();
values = m2.values();
entrySet = m3.entrySet();
objectCodes.add(System.identityHashCode(v));
}
use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.
the class MapsTest method testParseFromByteArray.
@AutoreleasePool
public void testParseFromByteArray() throws Exception {
ExtensionRegistry registry = ExtensionRegistry.newInstance();
MapMsg msg = MapMsg.parseFrom(ALL_MAPS_BYTES, registry);
checkFields(msg);
}
use of com.google.j2objc.annotations.AutoreleasePool in project j2objc by google.
the class JUnitTestRunner method run.
/**
* Runs the test classes given in {@param classes}.
* @returns Zero if all tests pass, non-zero otherwise.
*/
public static int run(Class<?>[] classes, RunListener listener) {
JUnitCore junitCore = new JUnitCore();
junitCore.addListener(listener);
boolean hasError = false;
for (@AutoreleasePool Class<?> c : classes) {
Result result = junitCore.run(c);
hasError = hasError || !result.wasSuccessful();
}
return hasError ? 1 : 0;
}
use of com.google.j2objc.annotations.AutoreleasePool in project squidb by yahoo.
the class SquidbTestRunner method run.
/**
* Runs the test classes given in {@param classes}.
*
* @returns Zero if all tests pass, non-zero otherwise.
*/
public static int run(Class[] classes, RunListener listener, PrintStream out) {
JUnitCore junitCore = new JUnitCore();
junitCore.addListener(listener);
boolean hasError = false;
int numTests = 0;
int numFailures = 0;
long start = System.currentTimeMillis();
for (@AutoreleasePool Class c : classes) {
out.println("Running " + c.getName());
Result result = junitCore.run(c);
numTests += result.getRunCount();
numFailures += result.getFailureCount();
hasError = hasError || !result.wasSuccessful();
}
long end = System.currentTimeMillis();
out.println(String.format("Ran %d tests, %d failures. Total time: %s seconds", numTests, numFailures, NumberFormat.getInstance().format((double) (end - start) / 1000)));
return hasError ? 1 : 0;
}
Aggregations