Here are the examples of the java api class java.util.NoSuchElementException taken from open source projects.
1. EucalyptusClientTask#dispatchFailure()
Project: eucalyptus
File: EucalyptusClientTask.java
File: EucalyptusClientTask.java
/** * @return True if the failure was handled and should be treated as success. */ boolean dispatchFailure(ClientContext<TM, TC> context, Throwable throwable) { final Optional<AsyncExceptions.AsyncWebServiceError> serviceErrorOption = AsyncExceptions.asWebServiceError(throwable); if (serviceErrorOption.isPresent()) { errorCode = serviceErrorOption.get().getCode(); errorMessage = serviceErrorOption.get().getMessage(); return false; } final NoSuchElementException ex2 = Exceptions.findCause(throwable, NoSuchElementException.class); if (ex2 != null) { errorMessage = ex2.getMessage(); return false; } LOG.error("Eucalyptus client error", throwable); return false; }
2. TestStoreFuncWrapper#testSucess()
Project: pig
File: TestStoreFuncWrapper.java
File: TestStoreFuncWrapper.java
// Asserts that each call to a Wrapper invokes the correct method on the Wrappee. @Test public void testSucess() throws IOException { DummyStoreFunc storeFunc = new DummyStoreFunc(); MockWrapper wrapper = new MockWrapper(storeFunc); wrapper.relToAbsPathForStoreLocation(null, null); assertEquals("relToAbsPathForStoreLocation", storeFunc.getLastMethodCalled()); wrapper.getOutputFormat(); assertEquals("getOutputFormat", storeFunc.getLastMethodCalled()); wrapper.setStoreLocation(null, null); assertEquals("setStoreLocation", storeFunc.getLastMethodCalled()); wrapper.checkSchema(null); assertEquals("checkSchema", storeFunc.getLastMethodCalled()); wrapper.prepareToWrite(null); assertEquals("prepareToWrite", storeFunc.getLastMethodCalled()); wrapper.putNext(null); assertEquals("putNext", storeFunc.getLastMethodCalled()); wrapper.setStoreFuncUDFContextSignature(null); assertEquals("setStoreFuncUDFContextSignature", storeFunc.getLastMethodCalled()); wrapper.cleanupOnSuccess(null, null); assertEquals("cleanupOnSuccess", storeFunc.getLastMethodCalled()); wrapper.cleanupOnFailure(null, null); assertEquals("cleanupOnFailure", storeFunc.getLastMethodCalled()); NoSuchElementException e = null; try { storeFunc.getLastMethodCalled(); } catch (NoSuchElementException ex) { e = ex; } assertNotNull("The wrapped class had more method invokations than it should have", e); }
3. TestStoreFuncMetadataWrapper#testSucess()
Project: pig
File: TestStoreFuncMetadataWrapper.java
File: TestStoreFuncMetadataWrapper.java
// Asserts that each call to a Wrapper invokes the correct method on the Wrappee. @Test public void testSucess() throws IOException { DummyStoreMetadata storeFunc = new DummyStoreMetadata(); MockWrapper wrapper = new MockWrapper(storeFunc); wrapper.storeSchema(null, null, null); assertEquals("storeSchema", storeFunc.getLastMethodCalled()); wrapper.storeStatistics(null, null, null); assertEquals("storeStatistics", storeFunc.getLastMethodCalled()); wrapper.relToAbsPathForStoreLocation(null, null); assertEquals("relToAbsPathForStoreLocation", storeFunc.getLastMethodCalled()); wrapper.getOutputFormat(); assertEquals("getOutputFormat", storeFunc.getLastMethodCalled()); wrapper.setStoreLocation(null, null); assertEquals("setStoreLocation", storeFunc.getLastMethodCalled()); wrapper.checkSchema(null); assertEquals("checkSchema", storeFunc.getLastMethodCalled()); wrapper.prepareToWrite(null); assertEquals("prepareToWrite", storeFunc.getLastMethodCalled()); wrapper.putNext(null); assertEquals("putNext", storeFunc.getLastMethodCalled()); wrapper.setStoreFuncUDFContextSignature(null); assertEquals("setStoreFuncUDFContextSignature", storeFunc.getLastMethodCalled()); wrapper.cleanupOnSuccess(null, null); assertEquals("cleanupOnSuccess", storeFunc.getLastMethodCalled()); wrapper.cleanupOnFailure(null, null); assertEquals("cleanupOnFailure", storeFunc.getLastMethodCalled()); NoSuchElementException e = null; try { storeFunc.getLastMethodCalled(); } catch (NoSuchElementException ex) { e = ex; } assertNotNull("The wrapped class had more method invokations than it should have", e); }
4. TestLoadFuncWrapper#testSucess()
Project: pig
File: TestLoadFuncWrapper.java
File: TestLoadFuncWrapper.java
// Asserts that each call to a Wrapper invokes the correct method on the Wrappee. @Test public void testSucess() throws IOException { DummyLoadFunc loadFunc = new DummyLoadFunc(); MockWrapper wrapper = new MockWrapper(loadFunc); wrapper.relativeToAbsolutePath(null, null); assertEquals("relativeToAbsolutePath", loadFunc.getLastMethodCalled()); wrapper.setLocation(null, null); assertEquals("setLocation", loadFunc.getLastMethodCalled()); wrapper.getInputFormat(); assertEquals("getInputFormat", loadFunc.getLastMethodCalled()); wrapper.getLoadCaster(); assertEquals("getLoadCaster", loadFunc.getLastMethodCalled()); wrapper.prepareToRead(null, null); assertEquals("prepareToRead", loadFunc.getLastMethodCalled()); wrapper.getNext(); assertEquals("getNext", loadFunc.getLastMethodCalled()); wrapper.setUDFContextSignature(null); assertEquals("setUDFContextSignature", loadFunc.getLastMethodCalled()); NoSuchElementException e = null; try { loadFunc.getLastMethodCalled(); } catch (NoSuchElementException ex) { e = ex; } assertNotNull("The wrapped class had more method invokations than it should have", e); }
5. TestLoadFuncMetadataWrapper#testSucess()
Project: pig
File: TestLoadFuncMetadataWrapper.java
File: TestLoadFuncMetadataWrapper.java
// Asserts that each call to a Wrapper invokes the correct method on the Wrappee. @Test public void testSucess() throws IOException { DummyLoadMetadata loadFunc = new DummyLoadMetadata(); MockWrapper wrapper = new MockWrapper(loadFunc); wrapper.getSchema(null, null); assertEquals("getSchema", loadFunc.getLastMethodCalled()); wrapper.getStatistics(null, null); assertEquals("getStatistics", loadFunc.getLastMethodCalled()); wrapper.getPartitionKeys(null, null); assertEquals("getPartitionKeys", loadFunc.getLastMethodCalled()); wrapper.setPartitionFilter(null); assertEquals("setPartitionFilter", loadFunc.getLastMethodCalled()); wrapper.relativeToAbsolutePath(null, null); assertEquals("relativeToAbsolutePath", loadFunc.getLastMethodCalled()); wrapper.setLocation(null, null); assertEquals("setLocation", loadFunc.getLastMethodCalled()); wrapper.getInputFormat(); assertEquals("getInputFormat", loadFunc.getLastMethodCalled()); wrapper.getLoadCaster(); assertEquals("getLoadCaster", loadFunc.getLastMethodCalled()); wrapper.prepareToRead(null, null); assertEquals("prepareToRead", loadFunc.getLastMethodCalled()); wrapper.getNext(); assertEquals("getNext", loadFunc.getLastMethodCalled()); wrapper.setUDFContextSignature(null); assertEquals("setUDFContextSignature", loadFunc.getLastMethodCalled()); NoSuchElementException e = null; try { loadFunc.getLastMethodCalled(); } catch (NoSuchElementException ex) { e = ex; } assertNotNull("The wrapped class had more method invokations than it should have", e); }
6. ExpectThrowableAssert_isThrownBy_Test#should_build_ExpectThrowableAssert_with_exception_thrown_by_lambda()
Project: assertj-core
File: ExpectThrowableAssert_isThrownBy_Test.java
File: ExpectThrowableAssert_isThrownBy_Test.java
@Test public void should_build_ExpectThrowableAssert_with_exception_thrown_by_lambda() { NoSuchElementException ex = new NoSuchElementException("no such element!"); // @format:off assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(() -> { throw ex; }).isSameAs(ex).withNoCause(); // @format:on }