Adding antlr4 to pom, tests
This commit is contained in:
@ -18,6 +18,10 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
@ -30,6 +34,10 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-core</artifactId>
|
||||
|
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
|
||||
|
||||
public class XmlCPDTokenizerTest extends AbstractTokenizerTest {
|
||||
|
||||
private static final String FILENAME = "hello.xml";
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void buildTokenizer() throws IOException {
|
||||
this.tokenizer = new XmlTokenizer();
|
||||
this.sourceCode = new SourceCode(new SourceCode.StringCodeLoader(this.getSampleCode(), FILENAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSampleCode() throws IOException {
|
||||
return IOUtils.toString(XmlTokenizer.class.getResourceAsStream(FILENAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tokenizeTest() throws IOException {
|
||||
this.expectedTokenCount = 37;
|
||||
super.tokenizeTest();
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<someTag>
|
||||
<someOtherTag>Somehow we would like to improve this xml so we are not repeating the same content in this file or other files</someOtherTag>
|
||||
<someOtherTag>Somehow we would like to improve this xml so we are not repeating the same content in this file or other files</someOtherTag>
|
||||
</someTag>
|
Reference in New Issue
Block a user