Как сгенерировать исключение для ошибки 404 в Munit 2 - PullRequest
0 голосов
/ 25 марта 2020

Я настроил компонент «Задать событие», но он не работал.

junit.framework.AssertionFailedError: Тест: 404-error-test ожидал сбой - Идентификатор ошибки: APIKIT: NOT_FOUND но это не удалось на junit.framework.Assert.fail (Assert. java: 57)

<munit:test name="404-error-test" description="404-error-test" expectedErrorType="APIKIT:NOT_FOUND">
    <munit:enable-flow-sources >
        <munit:enable-flow-source value="testvalidate-main" />
        <munit:enable-flow-source value="post:\validatetoken:testvalidate-config" />
    </munit:enable-flow-sources>
    <munit:execution >
        <munit:set-event doc:name="Set Event"  cloneOriginalEvent="true">
            <munit:attributes value="#[{ method : 'POST', requestPath: '/v1/resource', listenerPath: '/v1/resource',  headers : {'Authorization' :'Bearer b536b9a9-5e11-4773-93d3-8c973519ad54' }}]" />
        </munit:set-event>
        <logger level="INFO" doc:name="Logger" message="============#[attributes]"/>
        <flow-ref doc:name="post:\validatetoken:testvalidate-config" name="post:\validatetoken:testvalidate-config"/>
    </munit:execution>
</munit:test>
...