public static StackTraceElement[] extract(Throwable t, String fqnOfInvokingClass, final int maxDepth,
            List<String> frameworkPackageList) {
        if (t == null) {
            return null;
        }

        StackTraceElement[] steArray = t.getStackTrace();
        StackTraceElement[] callerDataArray;

        int found = LINE_NA;
        for (int i = 0; i < steArray.length; i++) {
            if (isInFrameworkSpace(steArray[i].getClassName(), fqnOfInvokingClass, frameworkPackageList)) {
                // the caller is assumed to be the next stack frame, hence the +1.
                found = i + 1;
            } else {
                if (found != LINE_NA) {
                    break;
                }
            }
        }

        // we failed to extract caller data
        if (found == LINE_NA) {
            return EMPTY_CALLER_DATA_ARRAY;
        }

        int availableDepth = steArray.length - found;
        int desiredDepth = maxDepth < (availableDepth) ? maxDepth : availableDepth;

        callerDataArray = new StackTraceElement[desiredDepth];
        for (int i = 0; i < desiredDepth; i++) {
            callerDataArray[i] = steArray[found + i];
        }
        return callerDataArray;
    }
@Test
    public void testBasic() {
        Throwable t = new Throwable();
        StackTraceElement[] steArray = t.getStackTrace();

        StackTraceElement[] cda = CallerData.extract(t, CallerDataTest.class.getName(), 100, null);
        Arrays.stream(cda).forEach( ste -> System.out.println(ste));
        assertNotNull(cda);
        assertTrue(cda.length > 0);
        assertEquals(steArray.length - 1, cda.length);
    }