Tabnine Logo
String.contains
Code IndexAdd Tabnine to your IDE (free)

How to use
contains
method
in
java.lang.String

Best Java code snippets using java.lang.String.contains (Showing top 20 results out of 155,178)

origin: square/okhttp

/**
 * Returns true if {@code e} is due to a firmware bug fixed after Android 4.2.2.
 * https://code.google.com/p/android/issues/detail?id=54072
 */
public static boolean isAndroidGetsocknameError(AssertionError e) {
 return e.getCause() != null && e.getMessage() != null
   && e.getMessage().contains("getsockname failed");
}
origin: ReactiveX/RxJava

  @Override
  public boolean test(Throwable t) {
    return t.getMessage() != null && t.getMessage().contains("Forced");
  }
});
origin: ReactiveX/RxJava

  @Override
  public String apply(Integer t) throws Exception {
    String name = Thread.currentThread().getName();
    if (name.contains("RxSingleScheduler")) {
      return "RxSingleScheduler";
    }
    return name;
  }
})
origin: ReactiveX/RxJava

  @Override
  public boolean test(Throwable t) throws Exception {
    return t.getMessage() != null && t.getMessage().contains("Forced");
  }
});
origin: ReactiveX/RxJava

  @Override
  public void subscribe(MaybeEmitter<Object> emitter) throws Exception {
    assertTrue(emitter.toString().contains(MaybeCreate.Emitter.class.getSimpleName()));
  }
}).test().assertEmpty();
origin: ReactiveX/RxJava

  @Override
  public void subscribe(SingleEmitter<Object> emitter) throws Exception {
    assertTrue(emitter.toString().contains(SingleCreate.Emitter.class.getSimpleName()));
  }
}).test().assertEmpty();
origin: ReactiveX/RxJava

/**
 * This hijacks the Throwable.printStackTrace() output and puts it in a string, where we can look for
 * "CIRCULAR REFERENCE" (a String added by Throwable.printEnclosedStackTrace)
 */
private static void assertNoCircularReferences(Throwable ex) {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  PrintStream printStream = new PrintStream(baos);
  ex.printStackTrace(printStream);
  assertFalse(baos.toString().contains("CIRCULAR REFERENCE"));
}
origin: ReactiveX/RxJava

  @Override
  public void subscribe(CompletableEmitter emitter) throws Exception {
    assertTrue(emitter.toString().contains(CompletableCreate.Emitter.class.getSimpleName()));
  }
}).test().assertEmpty();
origin: ReactiveX/RxJava

  @Override
  public void subscribe(FlowableEmitter<Object> emitter) throws Exception {
    assertTrue(emitter.toString().contains(entry.getValue().getSimpleName()));
    assertTrue(emitter.serialize().toString().contains(entry.getValue().getSimpleName()));
  }
}, entry.getKey()).test().assertEmpty();
origin: ReactiveX/RxJava

  @Override
  public void subscribe(ObservableEmitter<Object> emitter) throws Exception {
    assertTrue(emitter.toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName()));
    assertTrue(emitter.serialize().toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName()));
  }
}).test().assertEmpty();
origin: ReactiveX/RxJava

    @Override
    public void onError(Throwable e) {
      String trace = stackTraceAsString(e);
      System.out.println("On Error: " + trace);

      assertTrue(trace, trace.contains("OnNextValue"));

      assertTrue("No Cause on throwable" + e, e.getCause() != null);
//            assertTrue(e.getCause().getClass().getSimpleName() + " no OnNextValue",
//                    e.getCause() instanceof OnErrorThrowable.OnNextValue);
    }

origin: ReactiveX/RxJava

@Test
public void testOnErrorNotImplementedIsThrown() {
  List<Throwable> errors = TestHelper.trackPluginErrors();
  Observable.just(1, 2, 3).subscribe(new Consumer<Integer>() {
    @Override
    public void accept(Integer t1) {
      throw new RuntimeException("hello");
    }
  });
  TestHelper.assertError(errors, 0, RuntimeException.class);
  assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
  RxJavaPlugins.reset();
}
origin: ReactiveX/RxJava

@Test
public void disposeIndicated() {
  TestSubscriber<Object> ts = new TestSubscriber<Object>();
  ts.cancel();
  try {
    ts.assertResult(1);
    throw new RuntimeException("Should have thrown!");
  } catch (Throwable ex) {
    assertTrue(ex.toString(), ex.toString().contains("disposed!"));
  }
}
origin: ReactiveX/RxJava

@Test
public void printStackTrace() {
  StringWriter sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  new CompositeException(new TestException()).printStackTrace(pw);
  assertTrue(sw.toString().contains("TestException"));
}
origin: square/okhttp

public static String hostHeader(HttpUrl url, boolean includeDefaultPort) {
 String host = url.host().contains(":")
   ? "[" + url.host() + "]"
   : url.host();
 return includeDefaultPort || url.port() != HttpUrl.defaultPort(url.scheme())
   ? host + ":" + url.port()
   : host;
}
origin: ReactiveX/RxJava

@Test
public void assertNoTimeout2() {
  try {
    Flowable.never()
    .test()
    .awaitCount(1, TestWaitStrategy.SLEEP_1MS, 50)
    .assertNoTimeout();
    throw new RuntimeException("Should have thrown!");
  } catch (AssertionError ex) {
    assertTrue(ex.toString(), ex.getMessage().contains("Timeout?!"));
  }
}
origin: ReactiveX/RxJava

@Test
public void assertTimeout2() {
  try {
    Flowable.empty()
    .test()
    .awaitCount(1, TestWaitStrategy.SLEEP_1MS, 50)
    .assertTimeout();
    throw new RuntimeException("Should have thrown!");
  } catch (AssertionError ex) {
    assertTrue(ex.toString(), ex.getMessage().contains("No timeout?!"));
  }
}
origin: ReactiveX/RxJava

@Test
public void timeoutIndicated() throws InterruptedException {
  Thread.interrupted(); // clear flag
  TestSubscriber<Object> ts = Flowable.never()
  .test();
  assertFalse(ts.await(1, TimeUnit.MILLISECONDS));
  try {
    ts.assertResult(1);
    throw new RuntimeException("Should have thrown!");
  } catch (AssertionError ex) {
    assertTrue(ex.toString(), ex.toString().contains("timeout!"));
  }
}
origin: ReactiveX/RxJava

@Test
public void timeoutIndicated2() throws InterruptedException {
  try {
    Flowable.never()
    .test()
    .awaitDone(1, TimeUnit.MILLISECONDS)
    .assertResult(1);
    throw new RuntimeException("Should have thrown!");
  } catch (AssertionError ex) {
    assertTrue(ex.toString(), ex.toString().contains("timeout!"));
  }
}
origin: ReactiveX/RxJava

@Test
public void timeoutIndicated3() throws InterruptedException {
  TestSubscriber<Object> ts = Flowable.never()
  .test();
  assertFalse(ts.awaitTerminalEvent(1, TimeUnit.MILLISECONDS));
  try {
    ts.assertResult(1);
    throw new RuntimeException("Should have thrown!");
  } catch (AssertionError ex) {
    assertTrue(ex.toString(), ex.toString().contains("timeout!"));
  }
}
java.langStringcontains

Javadoc

Returns true if and only if this string contains the specified sequence of char values.

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • getBytes
  • toLowerCase,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now