boolean () { if (myIsEmptyIsCached) { return myIsEmpty; } if (!isSuite()) { // test - no matter what we will return myIsEmpty = true; myIsEmptyIsCached = true; return true; } myIsEmpty = true; final List<? extends SMTestProxy> allTestCases = getChildren(); for (SMTestProxy testOrSuite : allTestCases) { if (testOrSuite.isSuite()) { // suite if (!testOrSuite.isEmptySuite()) { // => parent suite isn't empty myIsEmpty = false; myIsEmptyIsCached = true; break; } // all suites are empty myIsEmpty = true; // we can cache only final state, otherwise test may be added myIsEmptyIsCached = myState.isFinal(); } else { // test => parent suite isn't empty myIsEmpty = false; myIsEmptyIsCached = true; break; } } return myIsEmpty; }