use of junit.framework.TestResult in project BTW by TechnionYearlyProject.
the class QueryTrafficLightExample method testGetAllTrafficLights.
/*
* @author Sharon Hadar
* @Date 21/01/2018*/
@Test
public void testGetAllTrafficLights() {
TestResult result = new TestResult();
MainDataBase.openConnection();
Query query = new QueryTrafficLightExample("first");
// MainDataBase database = new MainDataBase();
// Set<TrafficLight> trafficLights = (Set<TrafficLight>) database.queryDataBase(query);
Set<TrafficLight> trafficLights = (Set<TrafficLight>) MainDataBase.queryDataBase(query);
Iterator<TrafficLight> iterator = trafficLights.iterator();
// System.out.println("\n\n\nthe result set is:");
while (iterator.hasNext()) {
assertNotNull(iterator.next());
// System.out.println(iterator.next().toString());
}
MainDataBase.closeConnection();
}
use of junit.framework.TestResult in project BTW by TechnionYearlyProject.
the class QueryTrafficLightExample method testGetAllCenteralLocations.
/*
* @author Sharon Hadar
* @Date 21/01/2018*/
@Test
public void testGetAllCenteralLocations() {
TestResult result = new TestResult();
MainDataBase.openConnection();
Query query = new QueryCenteralLocationExample("first");
// MainDataBase database = new MainDataBase();
// Set<CentralLocation> centeralLocations = (Set<CentralLocation>) database.queryDataBase(query);
Set<CentralLocation> centeralLocations = (Set<CentralLocation>) MainDataBase.queryDataBase(query);
Iterator<CentralLocation> iterator = centeralLocations.iterator();
// System.out.println("\n\n\nthe result set is:");
while (iterator.hasNext()) {
assertNotNull(iterator.next());
// System.out.println(iterator.next().toString());
}
MainDataBase.closeConnection();
}
use of junit.framework.TestResult in project BTW by TechnionYearlyProject.
the class QueryTrafficLightExample method testGetAllRoadsSet.
// the test method name needs to begin with the word 'test'
/*
* @author Sharon Hadar
* @Date 21/01/2018*/
@Test
public void testGetAllRoadsSet() {
TestResult result = new TestResult();
MainDataBase.openConnection();
Query query = new QueryRoadExample("first");
// MainDataBase database = new MainDataBase();
// Set<Road> roads = (Set<Road>) database.queryDataBase(query);
Set<Road> roads = (Set<Road>) MainDataBase.queryDataBase(query);
Iterator<Road> iterator = roads.iterator();
// System.out.println("\n\n\nthe result set is:");
while (iterator.hasNext()) {
assertNotNull(iterator.next());
// System.out.println(iterator.next().toString());
}
MainDataBase.closeConnection();
}
use of junit.framework.TestResult in project streamsupport by stefan-zobel.
the class JSR166TestCase method main.
/**
* Runs all unit tests in the given test suite.
* Actual behavior influenced by jsr166.* system properties.
*/
static void main(Test suite, String[] args) {
if (useSecurityManager) {
System.err.println("Setting a permissive security manager");
Policy.setPolicy(permissivePolicy());
System.setSecurityManager(new SecurityManager());
}
for (int i = 0; i < suiteRuns; i++) {
TestResult result = newPithyTestRunner().doRun(suite);
if (!result.wasSuccessful())
System.exit(1);
System.gc();
System.runFinalization();
}
}
use of junit.framework.TestResult in project narayana by jbosstm.
the class TestRunner method execute.
/**
* Execute the specific test against the specified participant.
* @param participantURI The URI of the participant.
* @param testTimeout The test timeout.
* @param asyncTest The asynchronous test flag.
* @param testName The name of the test to execute.
* @return The test result.
*/
public static TestResult execute(final String participantURI, final long testTimeout, final boolean asyncTest, final String testName) {
MessageLogging.clearThreadLog();
final Test test;
if (TestConstants.NAME_ALL_TESTS.equals(testName)) {
final TestSuite testSuite = new TestSuite();
testSuite.addTest(new InteropTestSuite(participantURI, testTimeout, asyncTest, AT_TEST_CLASS));
testSuite.addTest(new InteropTestSuite(participantURI, testTimeout, asyncTest, BA_TEST_CLASS));
test = testSuite;
} else if (TestConstants.NAME_ALL_AT_TESTS.equals(testName)) {
test = new InteropTestSuite(participantURI, testTimeout, asyncTest, AT_TEST_CLASS);
} else if (TestConstants.NAME_ALL_BA_TESTS.equals(testName)) {
test = new InteropTestSuite(participantURI, testTimeout, asyncTest, BA_TEST_CLASS);
} else if (testName.startsWith(TestConstants.PREFIX_AT_TESTS)) {
final Class testClass = AT_TEST_CLASS;
try {
test = createTest(testClass, participantURI, testTimeout, asyncTest, testName);
} catch (final Throwable th) {
System.err.println("Unexpected error instantiating test class: " + th);
return null;
}
} else if (testName.startsWith(TestConstants.PREFIX_BA_TESTS)) {
final Class testClass = BA_TEST_CLASS;
try {
test = createTest(testClass, participantURI, testTimeout, asyncTest, testName);
} catch (final Throwable th) {
System.err.println("Unexpected error instantiating test class: " + th);
return null;
}
} else {
System.err.println("Unidentified test name: " + testName);
return null;
}
MessageLogging.appendThreadLog(LOG_MESSAGE_PREFIX);
final TestResult testResult = new FullTestResult();
test.run(testResult);
MessageLogging.appendThreadLog(LOG_MESSAGE_SUFFIX);
return testResult;
}
Aggregations