// Path: Profiler/src/main/java/net/jproffa/profiler/WithProfiling.java
// public final class WithProfiling implements TestRule {
//     private final boolean shouldEnableProfiling;
//     
//     private WithProfiling(boolean shouldEnableProfiling) {
//         this.shouldEnableProfiling = shouldEnableProfiling;
//     }
//     
//     public static void in(Runnable inner) {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             inner.run();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     public static void in(RunnableEx inner) throws Exception {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             inner.run();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     public static <V> V in(Callable<V> inner) throws Exception {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             return inner.call();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     /**
//      * Returns a JUnit rule that sets up and enables profiling before each test.
//      */
//     public static WithProfiling rule() {
//         return new WithProfiling(true);
//     }
//     
//     /**
//      * Returns a JUnit rule that sets up and optionally enables profiling before each test.
//      * 
//      * <p>
//      * If {@code enableProfiling} is false, it only ensures the profiler is initialized
//      * but disables profiling before each test. The test may use
//      * {@code WithProfiling.in(...)} to profile things itself.
//      * Note that you should need this rarely as the rule blacklists the test class
//      * anyway, so code in it does not count towards the profiling score.
//      */
//     public static WithProfiling rule(boolean enableProfiling) {
//         return new WithProfiling(enableProfiling);
//     }
// 
//     @Override
//     public Statement apply(final Statement base, final Description description) {
//         return new Statement() {
//             @Override
//             public void evaluate() throws Throwable {
//                 Util.loadAgent();
//                 ClassBlacklist.add(description.getTestClass());
//                 ProfileData.resetCounters();
//                 if (shouldEnableProfiling) {
//                     ProfileData.enableProfiling();
//                 } else {
//                     ProfileData.disableProfiling();
//                 }
//                 try {
//                     base.evaluate();
//                 } finally {
//                     ProfileData.disableProfiling();
//                 }
//             }
//         };
//     }
// }
// 
// Path: TestProject/src/main/java/net/jproffa/testproject/ThreadCreation.java
// public class ThreadCreation {
//     public static void createThreadAndStart() {
//         Thread t = new Thread();
//         t.start();
//         System.out.println("You should never see me!");
//     }
// }


import net.jproffa.profiler.WithProfiling;
import net.jproffa.testproject.ThreadCreation;
import org.junit.Test;
import static org.junit.Assert.fail;
import org.junit.Rule;
package net.jproffa.test;



public class PreventingThreadCreationTest {

    @Rule public WithProfiling profiling = WithProfiling.rule();

    @Test
    public void threadCreateTest() {
        try {
            WithProfiling.in(new Runnable() {
                @Override
                public void run() {
// Path: Profiler/src/main/java/net/jproffa/profiler/WithProfiling.java
// public final class WithProfiling implements TestRule {
//     private final boolean shouldEnableProfiling;
//     
//     private WithProfiling(boolean shouldEnableProfiling) {
//         this.shouldEnableProfiling = shouldEnableProfiling;
//     }
//     
//     public static void in(Runnable inner) {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             inner.run();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     public static void in(RunnableEx inner) throws Exception {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             inner.run();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     public static <V> V in(Callable<V> inner) throws Exception {
//         Util.loadAgent();
//         ProfileData.resetCounters();
//         ProfileData.enableProfiling();
//         try {
//             return inner.call();
//         } finally {
//             ProfileData.disableProfiling();
//         }
//     }
//     
//     /**
//      * Returns a JUnit rule that sets up and enables profiling before each test.
//      */
//     public static WithProfiling rule() {
//         return new WithProfiling(true);
//     }
//     
//     /**
//      * Returns a JUnit rule that sets up and optionally enables profiling before each test.
//      * 
//      * <p>
//      * If {@code enableProfiling} is false, it only ensures the profiler is initialized
//      * but disables profiling before each test. The test may use
//      * {@code WithProfiling.in(...)} to profile things itself.
//      * Note that you should need this rarely as the rule blacklists the test class
//      * anyway, so code in it does not count towards the profiling score.
//      */
//     public static WithProfiling rule(boolean enableProfiling) {
//         return new WithProfiling(enableProfiling);
//     }
// 
//     @Override
//     public Statement apply(final Statement base, final Description description) {
//         return new Statement() {
//             @Override
//             public void evaluate() throws Throwable {
//                 Util.loadAgent();
//                 ClassBlacklist.add(description.getTestClass());
//                 ProfileData.resetCounters();
//                 if (shouldEnableProfiling) {
//                     ProfileData.enableProfiling();
//                 } else {
//                     ProfileData.disableProfiling();
//                 }
//                 try {
//                     base.evaluate();
//                 } finally {
//                     ProfileData.disableProfiling();
//                 }
//             }
//         };
//     }
// }
// 
// Path: TestProject/src/main/java/net/jproffa/testproject/ThreadCreation.java
// public class ThreadCreation {
//     public static void createThreadAndStart() {
//         Thread t = new Thread();
//         t.start();
//         System.out.println("You should never see me!");
//     }
// }


// Path: TestProject/src/test/java/net/jproffa/test/PreventingThreadCreationTest.java
import net.jproffa.profiler.WithProfiling;
import net.jproffa.testproject.ThreadCreation;
import org.junit.Test;
import static org.junit.Assert.fail;
import org.junit.Rule;

package net.jproffa.test;



public class PreventingThreadCreationTest {

    @Rule public WithProfiling profiling = WithProfiling.rule();

    @Test
    public void threadCreateTest() {
        try {
            WithProfiling.in(new Runnable() {
                @Override
                public void run() {
                    ThreadCreation.createThreadAndStart();