Codota Logo
UptoTokenMatcher
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.sonar.duplications.statement.matcher.UptoTokenMatcher (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
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: 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: org.codehaus.sonar/sonar-duplications

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

Javadoc

Consumes everything up to one of the specified tokens.

Most used methods

  • <init>
  • matchToken

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Table (org.hibernate.mapping)
    A relational table
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