Comments (5)
@mock Service mocky; //<- doesn't get added to beanscope
Right, so the HttpClient is static scope ... and that means that the http server that it will hit/access is also "wired" to the static scope.
So the @Mock Service mocky
will be injected as a mock into the instance scope ... but IF the test is using the httpClient, that httpClient will hit the static scoped server instance which will NOT include that mock.
If it was the other way around [in terms of static scope and instance scope] like:
@Inject HttpClient client;
static @Mock Service mocky;
Or the same scope [both static or both instance scope] ... then tests can use both.
doesn't get added to beanscope
This statement is NOT correct. It is getting added to a beanScope ... it's that there are MULTIPLE BeanScopes (the static one and the instance one). The static scoped HttpClient will hit the static scoped Helidon instance (and that instance is created once at static class beforeAll time ...
from avaje-nima.
hmm, would this be an inject bug or an avaje nima bug?
from avaje-nima.
once again, the error is mine, it seems I get it working if I don't add static when injecting the client
from avaje-nima.
it seems I get it working if I don't add static when injecting the client
This does not make sense to me in that both static and non-static/instance are valid scopes.
Did this test use @Mock
or @Inject
? It could be that I'm assuming HttpClient is used with @Inject
and maybe that is confusing ?
from avaje-nima.
Did this test use @mock or @Inject? It could be that I'm assuming HttpClient is used with @Inject and maybe that is confusing ?
looked like this:
@InjectTest
TestyMcTest {
@Inject static HttpClient client;
@Mock Service mocky; //<- doesn't get added to beanscope
}
from avaje-nima.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avaje-nima.