Package uk.ac.uea.threadr.internal.testing

Examples of uk.ac.uea.threadr.internal.testing.SafetyTester


   * Tests the thread safety testing mechanism for a variety of cases.
   */
  @Test
  public final void testTestingOutput() {
   
    SafetyTester tester = new SafetyTester();
   
    assertEquals("Failed thread safe class.", ThreadSafety.THREAD,
        tester.testSafety(new ReferenceTask()));
    assertEquals("Failed VM safe class.", ThreadSafety.VM,
        tester.testSafety(new ReferenceVMTask()));
    assertEquals("Failed unsafe test class.", ThreadSafety.SEQUENTIAL,
        tester.testSafety(new ReferenceUnsafeTask()));
    assertEquals("Failed forced safety test class", ThreadSafety.THREAD,
        tester.testSafety(new ForcedSafe()));
    assertNotEquals("Failed unsafe complex type checks.",
        ThreadSafety.THREAD,
        tester.testSafety(new ComplexUnsafeTypes()));
    assertEquals("Failed safe complex type checks.", ThreadSafety.THREAD,
        tester.testSafety(new ComplexSafeTypes()));
  }
View Full Code Here


   * {@link ThreadSafety#SEQUENTIAL} be returned.
   */
  @Test
  public final void testProvidedTests() {
   
    SafetyTester tester = new SafetyTester();
    Set<ThreadTest> tests = new HashSet<>();
   
    tests.add(new ReferenceTest());
    tester.provideTests(tests);
   
    assertEquals("Incorrect test result returned.",
        ThreadSafety.SEQUENTIAL, tester.testSafety(new ReferenceTask()));
  }
View Full Code Here

  
   *  @since 1.5
   */
  public final void testSafety() {
   
    SafetyTester tester = new SafetyTester();
    tester.provideTests(tests); // Add our custom tests.
   
    /* Test all the unique classes passed to the framework. */
    for (Object t : tasks.getTasks()) {
      if (!threadSafeties.containsKey(t.getClass())
          || threadSafeties.get(t.getClass()) == null) {
        /* Test the thread safeness of tasks that haven't been tested
           or tasks that have a null result. */
        ThreadSafety threadSafety = tester.testSafety(t);     
        threadSafeties.put(t.getClass(), threadSafety);
      }
    }
  }
View Full Code Here

TOP

Related Classes of uk.ac.uea.threadr.internal.testing.SafetyTester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.