View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.cpd;
5   
6   import java.io.IOException;
7   
8   import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
9   
10  import org.apache.commons.io.IOUtils;
11  import org.junit.Before;
12  import org.junit.Test;
13  
14  
15  //Tests if the ObjectiveC tokenizer supports UTF-8 escapes in string literals
16  public class UTF8EscapesInStringLiteralObjCTokenizerTest extends AbstractTokenizerTest {
17  
18      private static final String FILENAME = "FileWithUTF8EscapeInStringLiteral.m";
19  
20      @Before
21      @Override
22      public void buildTokenizer() throws IOException {
23          this.tokenizer = new ObjectiveCTokenizer();
24          this.sourceCode = new SourceCode(new SourceCode.StringCodeLoader(this.getSampleCode(), FILENAME));
25      }
26  
27      @Override
28      public String getSampleCode() throws IOException {
29          return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), "UTF-8");
30      }
31  
32      @Test
33      public void tokenizeTest() throws IOException {
34          this.expectedTokenCount = 45;
35          super.tokenizeTest();
36      }
37  }