// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fcontext(String description, SafeBlock block) {
//     notAllowedWhenCIModeEnabled("fcontext");
//     isValidContext("fcontext");
//     ExampleGroupConfiguration config = new ExampleGroupConfiguration.Builder()
//         .description(description)
//         .executionFlag(FOCUSED)
//         .build();
//     contexts.get().current().addGroup(config, block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fdescribe(String description, SafeBlock block) {
//     notAllowedWhenCIModeEnabled("fdescribe");
//     isValidContext("fdescribe");
//     ExampleGroupConfiguration config = new ExampleGroupConfiguration.Builder()
//         .description(description)
//         .executionFlag(FOCUSED)
//         .build();
//     contexts.get().current().addGroup(config, block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fit(String description, UnsafeBlock block) {
//     fit(description, identity(), block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized List<Example> read(Class<?> specClass) {
//     contexts.set(new ExampleGroupContext());
//     try {
//         ExampleGroupDefinition exampleGroupDefinition = newExampleGroupDefinition(specClass, contexts.get());
// 
//         exampleGroupDefinition.accept(new DuplicatedBlockValidator());
// 
//         BlockExecutionStrategySelector strategySelector = new BlockExecutionStrategySelector();
//         exampleGroupDefinition.accept(strategySelector);
// 
//         ExampleBuilder exampleBuilder = new ExampleBuilder(strategySelector.strategy());
//         exampleGroupDefinition.accept(exampleBuilder);
// 
//         return exampleBuilder.build();
//     } finally {
//         contexts.set(null);
//     }
// }


import org.junit.Test;
import static j8spec.J8Spec.fcontext;
import static j8spec.J8Spec.fdescribe;
import static j8spec.J8Spec.fit;
import static j8spec.J8Spec.read;
package j8spec;



public class J8SpecFocusTest {

    static class FocusedExampleBlockOverwrittenSpec {{
        fit("some text", UnsafeBlock.NOOP);
        fit("some text", UnsafeBlock.NOOP);
    }}

    static class FocusedExampleWithCollectorOverwrittenSpec {{
        fit("some text", c -> c, UnsafeBlock.NOOP);
        fit("some text", UnsafeBlock.NOOP);
    }}

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fdescribe_method_direct_invocation() {
        fdescribe("some text", SafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fcontext_method_direct_invocation() {
        fcontext("some text", SafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fit_method_direct_invocation() {
        fit("some text", UnsafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fit_method_with_collector_direct_invocation() {
        fit("some text", c -> c, UnsafeBlock.NOOP);
    }

    @Test(expected = Exceptions.BlockAlreadyDefined.class)
    public void does_not_allow_focused_example_to_be_replaced() {
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fcontext(String description, SafeBlock block) {
//     notAllowedWhenCIModeEnabled("fcontext");
//     isValidContext("fcontext");
//     ExampleGroupConfiguration config = new ExampleGroupConfiguration.Builder()
//         .description(description)
//         .executionFlag(FOCUSED)
//         .build();
//     contexts.get().current().addGroup(config, block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fdescribe(String description, SafeBlock block) {
//     notAllowedWhenCIModeEnabled("fdescribe");
//     isValidContext("fdescribe");
//     ExampleGroupConfiguration config = new ExampleGroupConfiguration.Builder()
//         .description(description)
//         .executionFlag(FOCUSED)
//         .build();
//     contexts.get().current().addGroup(config, block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized void fit(String description, UnsafeBlock block) {
//     fit(description, identity(), block);
// }
// 
// Path: src/main/java/j8spec/J8Spec.java
// public static synchronized List<Example> read(Class<?> specClass) {
//     contexts.set(new ExampleGroupContext());
//     try {
//         ExampleGroupDefinition exampleGroupDefinition = newExampleGroupDefinition(specClass, contexts.get());
// 
//         exampleGroupDefinition.accept(new DuplicatedBlockValidator());
// 
//         BlockExecutionStrategySelector strategySelector = new BlockExecutionStrategySelector();
//         exampleGroupDefinition.accept(strategySelector);
// 
//         ExampleBuilder exampleBuilder = new ExampleBuilder(strategySelector.strategy());
//         exampleGroupDefinition.accept(exampleBuilder);
// 
//         return exampleBuilder.build();
//     } finally {
//         contexts.set(null);
//     }
// }


// Path: src/test/java/j8spec/J8SpecFocusTest.java
import org.junit.Test;
import static j8spec.J8Spec.fcontext;
import static j8spec.J8Spec.fdescribe;
import static j8spec.J8Spec.fit;
import static j8spec.J8Spec.read;

package j8spec;



public class J8SpecFocusTest {

    static class FocusedExampleBlockOverwrittenSpec {{
        fit("some text", UnsafeBlock.NOOP);
        fit("some text", UnsafeBlock.NOOP);
    }}

    static class FocusedExampleWithCollectorOverwrittenSpec {{
        fit("some text", c -> c, UnsafeBlock.NOOP);
        fit("some text", UnsafeBlock.NOOP);
    }}

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fdescribe_method_direct_invocation() {
        fdescribe("some text", SafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fcontext_method_direct_invocation() {
        fcontext("some text", SafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fit_method_direct_invocation() {
        fit("some text", UnsafeBlock.NOOP);
    }

    @Test(expected = Exceptions.IllegalContext.class)
    public void does_not_allow_fit_method_with_collector_direct_invocation() {
        fit("some text", c -> c, UnsafeBlock.NOOP);
    }

    @Test(expected = Exceptions.BlockAlreadyDefined.class)
    public void does_not_allow_focused_example_to_be_replaced() {
        read(FocusedExampleBlockOverwrittenSpec.class);