/** * The automated tests using assert statements. This method is called by SPASS-meter at end of * monitoring upon the <code>EndSystem</code> annotation. * * @since 1.00 */ public static void asserts() { long tolerance = 100 * 1000 * 1000; // ms boolean includeOuter = true; if (TestEnvironment.isIndirectTest()) { // accounted by setting includeOuter = false; } assertChain(MonitoringGroupValue.ALLOCATED_MEMORY, includeOuter); // no statement about used memory - this depends on the JVM // assertChain(MonitoringGroupValue.SYSTEM_TIME, false); // chain sequence is not ensured // due to unknown scheduling policy TestEnvironment.assertEquals( Runnable1.class.getName(), MonitoringGroupValue.SYSTEM_TIME, r1.getElapsedSystemTime(), tolerance); TestEnvironment.assertEquals( Runnable2.class.getName(), MonitoringGroupValue.SYSTEM_TIME, r2.getElapsedSystemTime(), tolerance); TestEnvironment.assertEquals( Runnable3.class.getName(), MonitoringGroupValue.SYSTEM_TIME, r3.getElapsedSystemTime(), tolerance); TestEnvironment.assertEquals( Runnable1.class.getName(), MonitoringGroupValue.CPU_TIME, r1.getElapsedCpuTime(), tolerance); TestEnvironment.assertEquals( Runnable2.class.getName(), MonitoringGroupValue.CPU_TIME, r2.getElapsedCpuTime(), tolerance); TestEnvironment.assertEquals( Runnable3.class.getName(), MonitoringGroupValue.CPU_TIME, r3.getElapsedCpuTime(), tolerance); assertZero(MonitoringGroupValue.FILE_READ); assertZero(MonitoringGroupValue.FILE_WRITE); assertZero(MonitoringGroupValue.NET_READ); assertZero(MonitoringGroupValue.NET_WRITE); assertZero(MonitoringGroupValue.TOTAL_READ); assertZero(MonitoringGroupValue.TOTAL_WRITE); TestEnvironment.success(ThreadedTest.class.getName()); }
/** * Asserts the value 0 for all monitoring groups. * * @param value the value to test * @since 1.00 */ private static void assertZero(MonitoringGroupValue value) { TestEnvironment.assertEquals(ThreadedTest.class.getName(), value, 0); TestEnvironment.assertEquals(Runnable1.class.getName(), value, 0); TestEnvironment.assertEquals(Runnable2.class.getName(), value, 0); TestEnvironment.assertEquals(Runnable3.class.getName(), value, 0); }