Codota Logo
UptoTokenMatcher.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.sonar.duplications.statement.matcher.UptoTokenMatcher
constructor

Best Java code snippets using org.sonar.duplications.statement.matcher.UptoTokenMatcher.<init> (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

public static TokenMatcher to(String... tokens) {
 return new UptoTokenMatcher(tokens);
}
origin: SonarSource/sonarqube

@Test(expected = IllegalArgumentException.class)
public void shouldNotAcceptNull() {
 new UptoTokenMatcher(null);
}
origin: SonarSource/sonarqube

@Test(expected = IllegalArgumentException.class)
public void shouldNotAcceptEmpty() {
 new UptoTokenMatcher(new String[] {});
}
origin: SonarSource/sonarqube

@Test
public void shouldNotMatch() {
 Token t1 = new Token("a", 1, 1);
 Token t2 = new Token("b", 2, 1);
 TokenQueue tokenQueue = spy(new TokenQueue(Arrays.asList(t1, t2)));
 List<Token> output = mock(List.class);
 UptoTokenMatcher matcher = new UptoTokenMatcher(new String[] { ";" });
 assertThat(matcher.matchToken(tokenQueue, output), is(false));
 verify(tokenQueue, times(2)).poll();
 verify(tokenQueue, times(2)).peek();
 verifyNoMoreInteractions(tokenQueue);
 verify(output).add(t1);
 verify(output).add(t2);
 verifyNoMoreInteractions(output);
}
origin: SonarSource/sonarqube

@Test
public void shouldMatch() {
 Token t1 = new Token("a", 1, 1);
 Token t2 = new Token(";", 2, 1); // should stop on this token
 Token t3 = new Token(";", 3, 1);
 TokenQueue tokenQueue = spy(new TokenQueue(Arrays.asList(t1, t2, t3)));
 List<Token> output = mock(List.class);
 UptoTokenMatcher matcher = new UptoTokenMatcher(new String[] { ";" });
 assertThat(matcher.matchToken(tokenQueue, output), is(true));
 verify(tokenQueue, times(2)).poll();
 verify(tokenQueue).peek();
 verifyNoMoreInteractions(tokenQueue);
 verify(output).add(t1);
 verify(output).add(t2);
 verifyNoMoreInteractions(output);
}
origin: SonarSource/sonarqube

@Test
public void shouldMatchAnyOfProvidedTokens() {
 Token t1 = new Token("a", 1, 1);
 Token t2 = new Token("{", 2, 1);
 Token t3 = new Token("b", 3, 1);
 Token t4 = new Token("}", 4, 1);
 TokenQueue tokenQueue = spy(new TokenQueue(Arrays.asList(t1, t2, t3, t4)));
 List<Token> output = mock(List.class);
 UptoTokenMatcher matcher = new UptoTokenMatcher(new String[] { "{", "}" });
 assertThat(matcher.matchToken(tokenQueue, output), is(true));
 assertThat(matcher.matchToken(tokenQueue, output), is(true));
 verify(tokenQueue, times(4)).poll();
 verify(tokenQueue, times(2)).peek();
 verifyNoMoreInteractions(tokenQueue);
 verify(output).add(t1);
 verify(output).add(t2);
 verify(output).add(t3);
 verify(output).add(t4);
 verifyNoMoreInteractions(output);
}
origin: org.codehaus.sonar/sonar-duplications

public static TokenMatcher to(String... tokens) {
 return new UptoTokenMatcher(tokens);
}
org.sonar.duplications.statement.matcherUptoTokenMatcher<init>

Popular methods of UptoTokenMatcher

  • matchToken

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • getSystemService (Context)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Collectors (java.util.stream)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now