congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IllegalStateException.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
java.lang.IllegalStateException

Best Java code snippets using java.lang.IllegalStateException.getMessage (Showing top 20 results out of 7,335)

origin: spring-projects/spring-framework

@MessageExceptionHandler
public void handleExceptionWithHandlerMethodArg(IllegalStateException ex, HandlerMethod handlerMethod) {
  this.method = "handleExceptionWithHandlerMethodArg";
  this.arguments.put("handlerMethod", handlerMethod);
  assertEquals("my cause", ex.getMessage());
}
origin: spring-projects/spring-framework

@Test
void invalidExpressionEvaluationType() {
  String methodName = "nonBooleanOrStringExpression";
  IllegalStateException exception = assertThrows(IllegalStateException.class,
    () -> condition.evaluateExecutionCondition(buildExtensionContext(methodName)));
  Method method = ReflectionUtils.findMethod(getClass(), methodName);
  assertThat(exception.getMessage(),
    is(equalTo("@DisabledIf(\"#{6 * 7}\") on " + method + " must evaluate to a String or a Boolean, not java.lang.Integer")));
}
origin: spring-projects/spring-framework

@Test
void unsupportedStringEvaluationValue() {
  String methodName = "stringExpressionThatIsNeitherTrueNorFalse";
  IllegalStateException exception = assertThrows(IllegalStateException.class,
    () -> condition.evaluateExecutionCondition(buildExtensionContext(methodName)));
  Method method = ReflectionUtils.findMethod(getClass(), methodName);
  assertThat(exception.getMessage(),
    is(equalTo("@DisabledIf(\"#{'enigma'}\") on " + method + " must evaluate to \"true\" or \"false\", not \"enigma\"")));
}
origin: spring-projects/spring-framework

private void testMetaClass(String xmlFile) {
  // expect the exception we threw in the custom metaclass to show it got invoked
  try {
    ApplicationContext ctx = new ClassPathXmlApplicationContext(xmlFile);
    Calculator calc = (Calculator) ctx.getBean("delegatingCalculator");
    calc.add(1, 2);
    fail("expected IllegalStateException");
  }
  catch (IllegalStateException ex) {
    assertEquals("Gotcha", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

private void assertContextConfigEntriesAreNotUnique(Class<?> testClass) {
  try {
    buildContextHierarchyMap(testClass);
    fail("Should throw an IllegalStateException");
  }
  catch (IllegalStateException e) {
    String msg = String.format(
      "The @ContextConfiguration elements configured via @ContextHierarchy in test class [%s] and its superclasses must define unique contexts per hierarchy level.",
      testClass.getName());
    assertEquals(msg, e.getMessage());
  }
}
origin: spring-projects/spring-framework

@Test
public void noCacheResolved() {
  Method method = ReflectionUtils.findMethod(SimpleService.class, "noCacheResolved", Object.class);
  try {
    this.simpleService.noCacheResolved(new Object());
    fail("Should have failed, no cache resolved");
  }
  catch (IllegalStateException ex) {
    assertTrue("Reference to the method must be contained in the message", ex.getMessage().contains(method.toString()));
  }
}
origin: spring-projects/spring-framework

private void assertExpressionIsBlank(String methodName) {
  IllegalStateException exception = assertThrows(IllegalStateException.class,
    () -> condition.evaluateExecutionCondition(buildExtensionContext(methodName)));
  assertThat(exception.getMessage(), containsString("must not be blank"));
}
origin: spring-projects/spring-framework

@Test
public void multipleCacheManagerBeans() {
  try {
    load(MultiCacheManagerConfig.class);
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("bean of type CacheManager"));
  }
}
origin: spring-projects/spring-framework

@Test
public void noCacheManagerBeans() {
  try {
    load(EmptyConfig.class);
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("no bean of type CacheManager"));
  }
}
origin: spring-projects/spring-framework

private void assertExceptionContains(String msg) throws Exception {
  try {
    listener.beforeTestMethod(testContext);
    fail("Should have thrown an IllegalStateException.");
  }
  catch (IllegalStateException e) {
    // System.err.println(e.getMessage());
    assertTrue("Exception message should contain: " + msg, e.getMessage().contains(msg));
  }
}
origin: spring-projects/spring-framework

@Test
public void noCacheManagerBeans() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(EmptyConfig.class);
  try {
    ctx.refresh();
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("no bean of type CacheManager"));
  }
}
origin: spring-projects/spring-framework

@Test
public void multipleCacheManagerBeans() {
  AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
  ctx.register(MultiCacheManagerConfig.class);
  try {
    ctx.refresh();
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("no unique bean of type CacheManager"));
  }
}
origin: spring-projects/spring-framework

@Test
public void maxSessions() {
  IntStream.range(0, 10000).forEach(i -> insertSession());
  try {
    insertSession();
    fail();
  }
  catch (IllegalStateException ex) {
    assertEquals("Max sessions limit reached: 10000", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

@Test
public void cannotResolveArg() throws Exception {
  try {
    getInvocable(Integer.class, String.class).invokeForRequest(request, null);
    fail("Expected exception");
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("Could not resolve parameter [0]"));
  }
}
origin: spring-projects/spring-framework

@Test
public void testFriendlyErrorOnNoLocationClassMatching() {
  AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
  try {
    pc.matches(ITestBean.class);
    fail();
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("expression"));
  }
}
origin: spring-projects/spring-framework

@Test
public void testFriendlyErrorOnNoLocation2ArgMatching() {
  AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
  try {
    pc.matches(getAge, ITestBean.class);
    fail();
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("expression"));
  }
}
origin: spring-projects/spring-framework

@Test
public void testFriendlyErrorOnNoLocation3ArgMatching() {
  AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
  try {
    pc.matches(getAge, ITestBean.class, (Object[]) null);
    fail();
  }
  catch (IllegalStateException ex) {
    assertTrue(ex.getMessage().contains("expression"));
  }
}
origin: spring-projects/spring-framework

@Test
public void shouldNotSupportNullConvertibleTypesFromNonConditionalGenericConverter() {
  GenericConverter converter = new NonConditionalGenericConverter();
  try {
    conversionService.addConverter(converter);
    fail("Did not throw IllegalStateException");
  }
  catch (IllegalStateException ex) {
    assertEquals("Only conditional converters may return null convertible types", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

@Test  // Based on SPR-13917 (spring-web)
public void invocationErrorMessage() throws Exception {
  this.resolvers.addResolver(new StubArgumentResolver(double.class));
  try {
    Method method = ResolvableMethod.on(Handler.class).mockCall(c -> c.handle(0.0)).method();
    invoke(new Handler(), method);
    fail();
  }
  catch (IllegalStateException ex) {
    assertThat(ex.getMessage(), containsString("Illegal argument"));
  }
}
origin: spring-projects/spring-framework

@Test
public void startAsyncAfterCompleted() throws Exception {
  this.asyncRequest.onComplete(new AsyncEvent(new MockAsyncContext(this.request, this.response)));
  try {
    this.asyncRequest.startAsync();
    fail("expected exception");
  }
  catch (IllegalStateException ex) {
    assertEquals("Async processing has already completed", ex.getMessage());
  }
}
java.langIllegalStateExceptiongetMessage

Popular methods of IllegalStateException

  • <init>
    Constructs a new IllegalStateException with the current stack trace and the specified cause.
  • printStackTrace
  • initCause
  • getStackTrace
  • setStackTrace
  • getCause
  • toString
  • addSuppressed
  • getLocalizedMessage
  • fillInStackTrace
  • getSuppressed
  • getSuppressed

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • 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
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 12 Jupyter Notebook extensions
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