congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
UnsupportedOperationException.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
java.lang.UnsupportedOperationException

Best Java code snippets using java.lang.UnsupportedOperationException.getMessage (Showing top 20 results out of 1,710)

origin: commons-lang/commons-lang

/**
 * Gets the combined the error message of this and any nested errors.
 *
 * @return the error message
 * @since 2.1
 */
public String getMessage() {
  if (super.getMessage() != null) {
    return super.getMessage();
  } else if (cause != null) {
    return cause.toString();
  } else {
    return null;
  }
}
origin: commons-io/commons-io

@Test
public void testMarkNotSupported() throws Exception {
  final Reader reader = new TestNullReader(100, false, true);
  assertFalse("Mark Should NOT be Supported", reader.markSupported());
  try {
    reader.mark(5);
    fail("mark() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("mark() error message",  "Mark not supported", e.getMessage());
  }
  try {
    reader.reset();
    fail("reset() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("reset() error message",  "Mark not supported", e.getMessage());
  }
  reader.close();
}
origin: commons-io/commons-io

@Test
public void testMarkNotSupported() throws Exception {
  final InputStream input = new TestNullInputStream(100, false, true);
  assertFalse("Mark Should NOT be Supported", input.markSupported());
  try {
    input.mark(5);
    fail("mark() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("mark() error message",  "Mark not supported", e.getMessage());
  }
  try {
    input.reset();
    fail("reset() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("reset() error message",  "Mark not supported", e.getMessage());
  }
  input.close();
}
origin: gocd/gocd

@Test
public void shouldNotAllowSettingOfConfigAttributes() throws Exception {
  KillAllChildProcessTask processTask = new KillAllChildProcessTask();
  try {
    processTask.setConfigAttributes(new HashMap());
    fail("should have failed, as configuration of kill-all task is not allowed");
  } catch (UnsupportedOperationException e) {
    assertThat(e.getMessage(), is("Not a configurable task"));
  }
}
origin: gocd/gocd

@Test
public void shouldNotAllowSettingOfConfigAttributes() throws Exception {
  Task task = new NullTask();
  try {
    task.setConfigAttributes(new HashMap());
    fail("should have failed, as configuration of kill-all task is not allowed");
  } catch (UnsupportedOperationException e) {
    assertThat(e.getMessage(), is("Not a configurable task"));
  }
}
origin: prestodb/presto

@Test
public void testMemoryFutureCancellation()
{
  setUpCountStarFromOrdersWithJoin();
  ListenableFuture future = userPool.reserve(fakeQueryId, "test", TEN_MEGABYTES.toBytes());
  assertTrue(!future.isDone());
  try {
    future.cancel(true);
    fail("cancel should fail");
  }
  catch (UnsupportedOperationException e) {
    assertEquals(e.getMessage(), "cancellation is not supported");
  }
  userPool.free(fakeQueryId, "test", TEN_MEGABYTES.toBytes());
  assertTrue(future.isDone());
}
origin: neo4j/neo4j

@Test
void markAsStaleIsUnsupported()
{
  UnsupportedOperationException uoe = assertThrows( UnsupportedOperationException.class, () -> indexReference.setStale() );
  assertEquals( uoe.getMessage(), "Read only indexes can't be marked as stale." );
}
origin: neo4j/neo4j

@Test
void obtainingWriterIsUnsupported()
{
  UnsupportedOperationException uoe = assertThrows( UnsupportedOperationException.class, () -> indexReference.getWriter() );
  assertEquals( uoe.getMessage(), "Read only indexes do not have index writers." );
}
origin: checkstyle/checkstyle

@Test
public void testIterate() {
  try (AxisIterator ignored = attributeNode.iterateAxis(AxisInfo.SELF)) {
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testIsIdref() {
  try {
    rootNode.isIdref();
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testAtomize() {
  try {
    rootNode.atomize();
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testGetAttributeValue() {
  try {
    attributeNode.getAttributeValue("", "");
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testGetColumnNumber() {
  try {
    attributeNode.getColumnNumber();
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testGetTokenType() {
  try {
    attributeNode.getTokenType();
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals(
      "Invalid exception message",
      "Operation is not supported",
      ex.getMessage());
  }
}
origin: spring-projects/spring-framework

@Test
public void testGetObjectTypeWithNoTargetOrTargetSource() {
  DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
  new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
  ITestBean tb = (ITestBean) bf.getBean("noTarget");
  try {
    tb.getName();
    fail();
  }
  catch (UnsupportedOperationException ex) {
    assertEquals("getName", ex.getMessage());
  }
  FactoryBean<?> pfb = (ProxyFactoryBean) bf.getBean("&noTarget");
  assertTrue("Has correct object type", ITestBean.class.isAssignableFrom(pfb.getObjectType()));
}
origin: neo4j/neo4j

@Test
void defaultQueryImplementationMustThrowForUnsupportedIndexOrder()
{
  // Given
  IndexReader indexReader = stubIndexReader();
  // Then
  String expectedMessage = String.format( "This reader only have support for index order %s. Provided index order was %s.",
      IndexOrder.NONE, IndexOrder.ASCENDING );
  UnsupportedOperationException operationException = assertThrows( UnsupportedOperationException.class,
      () -> indexReader.query( new SimpleNodeValueClient(), IndexOrder.ASCENDING, false, IndexQuery.exists( 1 ) ) );
  assertEquals( expectedMessage, operationException.getMessage() );
}
origin: checkstyle/checkstyle

@Test
public void testQueryElementNotImplementedAxis() throws Exception {
  final String xpath = "/CLASS_DEF//following-sibling::METHOD_DEF";
  final RootNode rootNode = getRootNode("InputXpathMapperAst.java");
  try {
    getXpathItems(xpath, rootNode);
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals("Invalid number of nodes", "Operation is not supported", ex.getMessage());
  }
}
origin: checkstyle/checkstyle

@Test
public void testQueryRootNotImplementedAxis() throws Exception {
  final String xpath = "//following-sibling::METHOD_DEF";
  final RootNode rootNode = getRootNode("InputXpathMapperAst.java");
  try {
    getXpathItems(xpath, rootNode);
    fail("Exception is excepted");
  }
  catch (UnsupportedOperationException ex) {
    assertEquals("Invalid number of nodes", "Operation is not supported", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Test
public void cacheExceptionRewriteCallStack() {
  final String keyItem = name.getMethodName();
  UnsupportedOperationException first = null;
  long ref = service.exceptionInvocations();
  try {
    service.cacheWithException(keyItem, true);
    fail("Should have thrown an exception");
  }
  catch (UnsupportedOperationException e) {
    first = e;
  }
  // Sanity check, this particular call has called the service
  assertEquals("First call should not have been cached", ref + 1, service.exceptionInvocations());
  UnsupportedOperationException second = methodInCallStack(keyItem);
  // Sanity check, this particular call has *not* called the service
  assertEquals("Second call should have been cached", ref + 1, service.exceptionInvocations());
  assertEquals(first.getCause(), second.getCause());
  assertEquals(first.getMessage(), second.getMessage());
  assertFalse("Original stack must not contain any reference to methodInCallStack",
      contain(first, AbstractJCacheAnnotationTests.class.getName(), "methodInCallStack"));
  assertTrue("Cached stack should have been rewritten with a reference to  methodInCallStack",
      contain(second, AbstractJCacheAnnotationTests.class.getName(), "methodInCallStack"));
}
origin: square/leakcanary

@Test public void throwExceptionWhenNotArrayValueForString() {
 buffer.setIntsToRead(COUNT_VALUE, OFFSET_VALUE, VALUE_ARRAY_INSTANCE_ID);
 buffer.setStringsToRead("abcdef");
 addStringClassToSnapshotWithFields(snapshot, new Field[]{
     new Field(Type.INT, "count"),
     new Field(Type.INT, "offset"),
     new Field(Type.OBJECT, "value")
 });
 ClassInstance stringInstance = createStringInstance();
 createObjectValueInstance();
 try {
  HahaHelper.asString(stringInstance);
  fail("this test should have thrown UnsupportedOperationException");
 } catch (UnsupportedOperationException uoe) {
  String message = uoe.getMessage();
  assertTrue(message.equals("Could not find char array in " + stringInstance));
 }
}
java.langUnsupportedOperationExceptiongetMessage

Popular methods of UnsupportedOperationException

  • <init>
    Constructs a new exception with the specified cause and a detail message of (cause==null ? null : c
  • getStackTrace
  • setStackTrace
  • printStackTrace
  • initCause
  • toString
  • getLocalizedMessage
  • getCause
  • fillInStackTrace

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • setScale (BigDecimal)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Runner (org.openjdk.jmh.runner)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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