@Test
public void testFail_With_400() throws Exception {

    // Given
    GenericCommand<String> command =
            getCommand("http://localhost:" + port + "/command/test/fail_with_400", GenericCommandTest::error);
    try {
        // When
        command.run();
    } catch (Exception e) {
        // Then
        // underlying was wrapped in another exception by error() method
        assertThat(e.getCause(), is(lastException));
        // underlying exception is a TDPException
        assertThat(lastException, isA(TDPException.class));
        // Underlying exception is expected to be MISSING_ACTION_SCOPE
        assertThat(lastException.getCode().getCode(), is(BaseErrorCodes.MISSING_ACTION_SCOPE.getCode()));
        // And status is 400.
        assertThat(lastException.getCode().getHttpStatus(), is(400));
    }
}