Package org.eclipse.microprofile.rest.client.tck.asynctests

# Class AsyncMethodTest

java.lang.Object
org.jboss.arquillian.testng.Arquillian
org.eclipse.microprofile.rest.client.tck.WiremockArquillianTest
org.eclipse.microprofile.rest.client.tck.asynctests.AsyncMethodTest

All Implemented Interfaces:
  `org.testng.IHookable`, `org.testng.ITestNGListener`

public class AsyncMethodTest extends WiremockArquillianTest
Verifies via CDI injection that you can use a programmatic interface. verifies that the interface has Dependent scope. This test is the same as the `CDIInvokeSimpleGetOperationTest` but uses async methods.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.jboss.arquillian.testng.Arquillian

`org.jboss.arquillian.testng.Arquillian.UpdateResultListener`

## Field Summary

### Fields inherited from class org.jboss.arquillian.testng.Arquillian

`ARQUILLIAN_DATA_PROVIDER`

## Constructor Summary

Constructors
Constructor
Description
`AsyncMethodTest()`

## Method Summary

Modifier and Type
Method
Description
`static org.jboss.shrinkwrap.api.spec.WebArchive`
`createDeployment()`
`void`
`testAsyncInvocationInterceptorProvider()`
This test uses a `ClientRequestFilter` to update the destination URI.
`void`
`testExecutorService()`
Tests that the MP Rest Client implementation uses the specified ExecutorService.
`void`
`testInterfaceMethodWithCompletionStageObjectReturnIsInvokedAsynchronously()`
Tests that a Rest Client interface method that returns a CompletionStage where it's parameterized type is some Object type other than Response) is invoked asychronously - checking that the thread ID of the response does not match the thread ID of the calling thread.
`void`
`testInterfaceMethodWithCompletionStageResponseReturnIsInvokedAsynchronously()`
Tests that a Rest Client interface method that returns CompletionStage is invoked asychronously - checking that the thread ID of the response does not match the thread ID of the calling thread.
`void`
`testNullExecutorServiceThrowsIllegalArgumentException()`
This test verifies that the `RestClientBuilder` implementation will throw an `IllegalArgumentException` when a null value is passed to the `executorService` method.

### Methods inherited from class org.eclipse.microprofile.rest.client.tck.WiremockArquillianTest

`getPort, getServerURI, getServerURL, getStringURL, setupServer`

### Methods inherited from class org.jboss.arquillian.testng.Arquillian

`arquillianAfterClass, arquillianAfterSuite, arquillianAfterTest, arquillianArgumentProvider, arquillianBeforeClass, arquillianBeforeSuite, arquillianBeforeTest, run`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AsyncMethodTest

public AsyncMethodTest()

## Method Details

### createDeployment

@Deployment public static org.jboss.shrinkwrap.api.spec.WebArchive createDeployment()

### testInterfaceMethodWithCompletionStageResponseReturnIsInvokedAsynchronously

public void testInterfaceMethodWithCompletionStageResponseReturnIsInvokedAsynchronously() throws Exception
Tests that a Rest Client interface method that returns CompletionStage is invoked asychronously - checking that the thread ID of the response does not match the thread ID of the calling thread.

Throws:
  `Exception` - - indicates test failure

### testInterfaceMethodWithCompletionStageObjectReturnIsInvokedAsynchronously

public void testInterfaceMethodWithCompletionStageObjectReturnIsInvokedAsynchronously() throws Exception
Tests that a Rest Client interface method that returns a CompletionStage where it's parameterized type is some Object type other than Response) is invoked asychronously - checking that the thread ID of the response does not match the thread ID of the calling thread.

Throws:
  `Exception` - - indicates test failure

### testExecutorService

public void testExecutorService() throws Exception
Tests that the MP Rest Client implementation uses the specified ExecutorService.

Throws:
  `Exception` - - indicates test failure

### testAsyncInvocationInterceptorProvider

public void testAsyncInvocationInterceptorProvider() throws Exception
This test uses a `ClientRequestFilter` to update the destination URI. It attempts to update it based on a ThreadLocal object on the calling thread. It uses an `AsyncInvocationInterceptorFactory` provider to copy the ThreadLocal value from the calling thread to the async thread.

Throws:
  `Exception` - - indicates test failure

### testNullExecutorServiceThrowsIllegalArgumentException

public void testNullExecutorServiceThrowsIllegalArgumentException()
This test verifies that the `RestClientBuilder` implementation will throw an `IllegalArgumentException` when a null value is passed to the `executorService` method.

Throws:
  `IllegalArgumentException` - - expected when passing null