### Question:
BbCodeReviewProcessor extends TextProcessorAdapter implements TextProcessor, TextPostProcessor { @Override public String process(String bbEncodedText) { HttpServletRequest httpServletRequest = getServletRequest(); httpServletRequest.removeAttribute(REPLACE_HISTORY_LIST_ATTRIBUTE); if (!isCodeReviewPost(httpServletRequest) || !isValidCodeReviewBbCodeString(bbEncodedText)) { return bbEncodedText; } List<Boolean> replaceHistoryList = getReplaceHistoryList(bbEncodedText); if (replaceHistoryList.isEmpty()) { return bbEncodedText; } httpServletRequest.setAttribute(REPLACE_HISTORY_LIST_ATTRIBUTE, replaceHistoryList); return substituteCloseCodeTagsWithTemporaryReplacementInEncodedText(bbEncodedText); }  @Override String process(String bbEncodedText); @Override CharSequence process(CharSequence bbEncodedText); @Override String postProcess(String bbDecodedText);  }### Answer:
@Test(dataProvider="preProcessingPosts") public void regularNoneCodeReviewPostIsReturnedAsSameText(String bbCode, String expectedResult) { when(request.getAttribute("isCodeReviewPost")).thenReturn(null); assertEquals(service.process(bbCode), bbCode); }
@Test(dataProvider="preProcessingPosts") public void preprocessorShouldSubstituteClosingCodeTags(String bbCode, String expectedResult) { when(request.getAttribute("isCodeReviewPost")).thenReturn("true"); assertEquals(service.process(bbCode), expectedResult); }
@Test(dataProvider="preProcessingPosts") public void preprocessorCharSequenceInterfaceShouldWorkAsString(String bbCode, String expectedResult) { when(request.getAttribute("isCodeReviewPost")).thenReturn("true"); CharSequence charSequence = new StringBuilder(bbCode).subSequence(0, bbCode.length()); assertEquals(service.process(charSequence).toString(), expectedResult); }