Giter Club home page Giter Club logo

wildfly-showcase's People

Contributors

stephan-mueller avatar

Stargazers

 avatar  avatar

Watchers

 avatar

wildfly-showcase's Issues

RESTEasy 0031135: Class must be annotated with @Path exception in Mockito Unit Tests

Hello,
This is not an issue but rather a question. I have cloned this repository, tested it and it worked as expected. However, using the sample project as a template for developing my own ones, I have the mentioned exception running a Mockito unit test, the equivalent of what you're doing in the GreetResourceTest class, when you invoke the resource, as follows:

Response response = resource.greet("Stephan");

Of course, I have a different context, but everything is similar, in the sense that there is an API resource, injecting and invoking a service, etc. So I'm mocking these components in a similar way, for example:

  @Mock
  private Service service;
  @InjectMocks
  private Resource resource;

I'm trying to call the API:

Response response = resource.doSomething();

thinking that in the context of a unit test, with Mockito, this call doesn't require JAX-RS client, as this is the case in your project. However, the exception is raised, which doesn't happen when I run your project and, comparing both, I don't see significant differences of maven artifacts or anything else then just context.
Do you have an idea of why it happens in my case and not in yours ? Of course, I'm doing thae equivalent of what you're doing here:

Mockito.lenient().doCallRealMethod().when(service).getMessage(Mockito.anyString());

Many thanks in advance for your help.

Kind regards,

Nicolas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.