Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a lesser priority than the default one #3309

Conversation

loicmathieu
Copy link
Contributor

Adding a lesser priority than the default one for the NotFoundExceptionMapper allow a user to easily override it.

Be careful that for this to work the exception mapper needs to be of the same parameter type: ExceptionMapper<NotFoundException> if a broader parameter type is used like ExceptionMapper<RuntimeException it will not take precedence from the default one.

Tested on a local project but no test provided.

Refers to #3253

Adding a lesser priority than the default one for the NotFoundExceptionMapper allow a user to easily override it.
@kenfinnigan
Copy link
Member

Is it possible to add an integration test for this?

It would be important to ensure this doesn't regress with other changes

@loicmathieu
Copy link
Contributor Author

@kenfinnigan I can add a testcase in the resteasy extension with the other test cases but I don't know how to create a test case that runs in dev mode ...

My current test case is as following but it didn't run as dev mode so it didn't implies any regression protection

public class CustomExceptionMapperTestCase {
    @RegisterExtension
    static QuarkusUnitTest runner = new QuarkusUnitTest()
            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
                    .addClasses(RootResource.class, CustomExceptionMapper.class));

    @Test
    public void testResourceNotFound() {
        RestAssured.when().get("/not_found")
                .then()
                    .statusCode(200)
                    .body(Matchers.is("not found but OK"));
    }
}

@kenfinnigan
Copy link
Member

@stuartwdouglas do we have a way to test DEV mode during the build?

How do we prevent regressions in DEV mode?

@stuartwdouglas
Copy link
Member

We have tests in the maven plugin integration tests. They are slow and don't really scale so the plan is to write a dev mode test framework however it is just something that nobody has got to yet.

This is the second time this has come up today so maybe I need to move it up my list.

@loicmathieu
Copy link
Contributor Author

@stuartwdouglas it's the one from the maven plugin like io.quarkus.maven.it.DevMojoIT ?

It's very complicate to setup (needs a whole project) and I don't think it is really needed to just test this kind of small functionalities.

I propose to skip the test untill we have an easy way to setup test in dev mode via QuarkusUnitTest ...

@stuartwdouglas
Copy link
Member

I agree

@stuartwdouglas
Copy link
Member

#3317

@kenfinnigan kenfinnigan merged commit f692657 into quarkusio:master Jul 24, 2019
@kenfinnigan kenfinnigan added this to the 0.20.0 milestone Jul 24, 2019
@loicmathieu loicmathieu deleted the fix/resteasy_exceptionmapper_priority branch July 25, 2019 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants