@Test
public void testBlockCommentUncomment() throws BadLocationException {

    org.junit.Assume.assumeTrue(!GraphicsEnvironment.isHeadless());
    RSyntaxTextArea scriptPanel = new RSyntaxTextArea();
    scriptPanel.setText(TEXT);
    scriptPanel.select(13, 226);
    final String originalText = scriptPanel.getText();
    // Block comment the selection
    CommentUtil.blockCommentOrUncomment(scriptPanel);
    assertEquals(13, scriptPanel.getSelectionStart());
    assertEquals(226 + CommentUtil.BLOCK_COMMENT_START.length()
            + CommentUtil.BLOCK_COMMENT_END.length(),
            scriptPanel.getSelectionEnd());
    // Block uncomment the selection
    CommentUtil.blockCommentOrUncomment(scriptPanel);
    assertEquals(13, scriptPanel.getSelectionStart());
    assertEquals(226, scriptPanel.getSelectionEnd());
    assertEquals(originalText, scriptPanel.getText());
}