/*
 * Copyright (C) 2016 Reece H. Dunn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.co.reecedunn.intellij.plugin.core.tests.lexer;

import com.intellij.lexer.Lexer;
import com.intellij.psi.tree.IElementType;
import junit.framework.TestCase;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class LexerTestCase extends TestCase {
    // region Lexer Test Helpers

    protected void matchToken(Lexer lexer, String text, int state, int start, int end, IElementType type) {
        assertThat(lexer.getTokenText(), is(text));
        assertThat(lexer.getState(), is(state));
        assertThat(lexer.getTokenStart(), is(start));
        assertThat(lexer.getTokenEnd(), is(end));
        assertThat(lexer.getTokenType(), is(type));

        if (lexer.getTokenType() == null) {
            assertThat(lexer.getBufferEnd(), is(start));
            assertThat(lexer.getBufferEnd(), is(end));
        }

        lexer.advance();
    }

    protected void matchSingleToken(Lexer lexer, String text, int state, IElementType type) {
        final int length = text.length();
        lexer.start(text);
        matchToken(lexer, text, 0,     0,      length, type);
        matchToken(lexer, "",   state, length, length, null);
    }

    protected void matchSingleToken(Lexer lexer, String text, IElementType type) {
        matchSingleToken(lexer, text, 0, type);
    }

    // endregion
}

@@ -859,16 +859,25 @@
 %0Apublic 
+abstract 
 class Le

Make LexerTestCase abstract so that it is not run with the JUnit test framework.