Search in sources :

Example 1 with VeganPolicy

use of org.mule.test.vegan.extension.VeganPolicy in project mule by mulesoft.

the class ExtensionsClientTestCase method executeOperationWithNullSafeParameter.

@Test
@Description("Executes an operation that has a @NullSafe annotated parameter using the client and checks the output")
public void executeOperationWithNullSafeParameter() throws Throwable {
    OperationParameters params = builder().configName("banana").build();
    Result<VeganPolicy, Object> result = doExecute(VEGAN, "applyPolicy", params);
    assertThat(result.getOutput().getMeetAllowed(), is(false));
    assertThat(result.getOutput().getIngredients().getSaltMiligrams(), is(0));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) VeganPolicy(org.mule.test.vegan.extension.VeganPolicy) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 2 with VeganPolicy

use of org.mule.test.vegan.extension.VeganPolicy in project mule by mulesoft.

the class NullSafeOnImplicitElementTestCase method nullSafeOnImplicitConnectionProvider.

@Test
public void nullSafeOnImplicitConnectionProvider() throws Exception {
    VeganPolicy policy = (VeganPolicy) flowRunner("grape-operation").run().getMessage().getPayload().getValue();
    assertThat(policy, is(notNullValue()));
    assertThat(policy.getMeetAllowed(), is(false));
    assertThat(policy.getMaxCalories(), is(500));
}
Also used : VeganPolicy(org.mule.test.vegan.extension.VeganPolicy) Test(org.junit.Test)

Example 3 with VeganPolicy

use of org.mule.test.vegan.extension.VeganPolicy in project mule by mulesoft.

the class NullSafeParameterTestCase method getNullSafeObject.

@Test
public void getNullSafeObject() throws Exception {
    VeganPolicy policy = (VeganPolicy) flowRunner("policy").run().getMessage().getPayload().getValue();
    assertThat(policy, is(notNullValue()));
    assertThat(policy.getMeetAllowed(), is(false));
    assertThat(policy.getIngredients(), is(notNullValue()));
    assertThat(policy.getIngredients().getSaltMiligrams(), is(0));
    assertThat(policy.getIngredients().getSaltReplacementName(), is(nullValue()));
}
Also used : VeganPolicy(org.mule.test.vegan.extension.VeganPolicy) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 VeganPolicy (org.mule.test.vegan.extension.VeganPolicy)3 Description (io.qameta.allure.Description)1 OperationParameters (org.mule.runtime.extension.api.client.OperationParameters)1