package net.ranides.assira.junit;

import java.util.Arrays;

public class ManualTestUtils {

    public static void sleep(long millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            throw TestUtils.rethrow(e);
        }
    }

    public static void trace(Object message) {
        if(IdeaInner.IDEA) {
            System.out.println(message);
        }
    }

    private static class IdeaInner {
        private static final boolean IDEA = Arrays.stream(new RuntimeException().getStackTrace())
            .anyMatch(frame -> frame.getClassName().startsWith("com.intellij."));
    }

}
