public static String renderPageWithSetupsAndTeardowns(
PageData pageData, boolean isSuite
) throws Exception {
boolean isTestPage = pageData.hasAttribute("Test");
if(isTestPage) {
WikiPage testPage = pageData.getWikiPage();
StringBuffer newPageContent = new StringBuffer();
includeSetupPages(testPage, newPageContent, isSuite);
...
...
...
}
return pageData.getHtml();
}
⬇️
public static String renderPageWithSetupsAndTeardowns(
PageData pageData, boolean isSuite
) throws Exception {
if(isTestPage(pageData)) includeSetupAndTeardownPages(pageData, isSuite);
return pageData.getHtml();
}
// bad
if(a) {
if(b) {
if(c) {
}
}
}
else 부분을 먼저 처리 + 성능 향상을 위해 function early return 으로 조기종료
// good
function aaa() {
if(c) return c;
if(b) return b;
if(a) return a;
}