Search in sources :

Example 1 with AddNumbersImplService

use of annotations.client.AddNumbersImplService in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersTest method testSuccess.

@Test
public void testSuccess() throws AddNumbersException_Exception {
    AddNumbers port = new AddNumbersImplService().getAddNumbersImplPort();
    Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
    int number1 = 10;
    int number2 = 20;
    System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
    int result = port.add(number1, number2);
    System.out.printf("The result of adding %d and %d is %d.\n\n", number1, number2, result);
    Assertions.assertEquals(30, result);
}
Also used : AddNumbersImplService(annotations.client.AddNumbersImplService) AddNumbers(annotations.client.AddNumbers) BindingProvider(jakarta.xml.ws.BindingProvider) Test(org.junit.jupiter.api.Test)

Example 2 with AddNumbersImplService

use of annotations.client.AddNumbersImplService in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersTest method testFault.

@Test
public void testFault() throws AddNumbersException_Exception {
    AddNumbers port = new AddNumbersImplService().getAddNumbersImplPort();
    try {
        int number1 = -10;
        int number2 = 20;
        System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
        int result = port.add(number1, number2);
        System.out.printf("The result of adding %d and %d is %d.\n", number1, number2, result);
        Assertions.fail();
    } catch (AddNumbersException_Exception ex) {
        System.out.printf("Caught AddNumbersException_Exception: %s\n", ex.getFaultInfo().getFaultInfo());
    }
}
Also used : AddNumbersException_Exception(annotations.client.AddNumbersException_Exception) AddNumbersImplService(annotations.client.AddNumbersImplService) AddNumbers(annotations.client.AddNumbers) Test(org.junit.jupiter.api.Test)

Aggregations

AddNumbers (annotations.client.AddNumbers)2 AddNumbersImplService (annotations.client.AddNumbersImplService)2 Test (org.junit.jupiter.api.Test)2 AddNumbersException_Exception (annotations.client.AddNumbersException_Exception)1 BindingProvider (jakarta.xml.ws.BindingProvider)1