### Question:
BbCodeReviewProcessor extends TextProcessorAdapter implements TextProcessor, TextPostProcessor { @Override public String postProcess(String bbDecodedText) { HttpServletRequest httpServletRequest = getServletRequest(); if (!isCodeReviewPost(httpServletRequest)) { return bbDecodedText; } @SuppressWarnings("unchecked") List<Boolean> replaceHistoryList = (List<Boolean>) httpServletRequest.getAttribute(REPLACE_HISTORY_LIST_ATTRIBUTE); if (replaceHistoryList == null) { return bbDecodedText; } httpServletRequest.removeAttribute(REPLACE_HISTORY_LIST_ATTRIBUTE); return removeTemporaryReplacementSubstitutionFromDecodedText(bbDecodedText, replaceHistoryList); }  @Override String process(String bbEncodedText); @Override CharSequence process(CharSequence bbEncodedText); @Override String postProcess(String bbDecodedText);  }### Answer:
@Test public void postprocessorShouldСorrectlyReturnUserCloseTag() { when(request.getAttribute("isCodeReviewPost")).thenReturn("true"); List<Boolean> replaceHistoryList = Lists.newArrayList(true); when(request.getAttribute(BbCodeReviewProcessor.REPLACE_HISTORY_LIST_ATTRIBUTE)).thenReturn(replaceHistoryList); assertEquals(service.postProcess("<pre>int good=2;[-code]</pre>"), "<pre>int good=2;[/code]</pre>"); }
@Test public void postprocessorShouldСorrectlyReturnOurSubstitution() { when(request.getAttribute("isCodeReviewPost")).thenReturn("true"); List<Boolean> replaceHistoryList = Lists.newArrayList(false, false); when(request.getAttribute(BbCodeReviewProcessor.REPLACE_HISTORY_LIST_ATTRIBUTE)).thenReturn(replaceHistoryList); assertEquals(service.postProcess("<pre>int good=2;[-code][-code]</pre>"), "<pre>int good=2;[-code][-code]</pre>"); }
@Test public void postprocessorShouldСorrectlyReturnUserCloseTagAndOurSubstitution() { when(request.getAttribute("isCodeReviewPost")).thenReturn("true"); List<Boolean> replaceHistoryList = Lists.newArrayList(true, false, true); when(request.getAttribute(BbCodeReviewProcessor.REPLACE_HISTORY_LIST_ATTRIBUTE)).thenReturn(replaceHistoryList); assertEquals(service.postProcess("<pre>int good=2;[-code][-code][-code]</pre>"), "<pre>int good=2;[/code][-code][/code]</pre>"); }