package havarunner;


import havarunner.exception.UnsupportedAnnotationException;
import org.junit.After;
import org.junit.Test;

import static havarunner.TestHelper.run;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class UnsupportedJUnitAnnotationsTest {

    @Test
    public void HavaRunner_gives_a_helpful_error_message_when_a_test_uses_an_unsupported_junit_annotation() {
        HavaRunner havaRunner = new HavaRunner(TestWithUnsupportedJUnitAnnotation.class);
        try {
            run(havaRunner);
            fail("Must throw an exception");
        } catch (UnsupportedAnnotationException e) {
            assertEquals(e.annotationClass(), After.class);
            assertEquals(
                    "class havarunner.UnsupportedJUnitAnnotationsTest$TestWithUnsupportedJUnitAnnotation uses the unsupported annotation org.junit.After",
                    e.getMessage()
            );
        }
    }

    static class TestWithUnsupportedJUnitAnnotation {
        @After
        void HavaRunner_does_not_support_the_After_annotation() {
        }

        @Test
        void this_test_will_not_be_run_because_the_BeforeClass_annotation_is_present() {

        }
    }
}

@@ -162,18 +162,43 @@
 lper.run
+AndRecordFailedAssumption
 ;%0A
-
 import s
@@ -542,140 +542,128 @@
     
-try %7B%0A            run(havaRunner);%0A            fail(%22Must throw an exception%22);%0A        %7D catch (UnsupportedAnnotationException e) %7B
+UnsupportedAnnotationException report = (UnsupportedAnnotationException) runAndRecordFailedAssumption(havaRunner).get();
 %0A   
@@ -659,36 +659,32 @@
 .get();%0A        
-    
 assertEquals(e.a
@@ -680,17 +680,22 @@
 tEquals(
-e
+report
 .annotat
@@ -724,28 +724,24 @@
 s);%0A        
-  
-  
 assertEquals
@@ -742,24 +742,16 @@
 Equals(%0A
-        
         
@@ -905,17 +905,14 @@
     
-        e
+report
 .get
@@ -933,24 +933,10 @@
     
- 
-   );%0A        %7D
+);
 %0A   

Fix test