You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a|add JaxRs support to the test class. Only used with `@DisableDiscovery` annotation, otherwise an exception will be thrown. Automatically adds the following Beans and Extensions to the test class:
In current example Helidon container will be launched prior test. The _Bean Discovery_ will be disabled. _MyBean_ will be added to the test, so that it can be injected. _ConfigCdiExtension_ will be enabled for this test. And finally, a configuration property will be added using `@AddConfig` annotation.
126
+
In the current example, Helidon container will be launched prior test. The _Bean Discovery_ will be disabled. _MyBean_ will be added to the test, so that it can be injected. _ConfigCdiExtension_ will be enabled for this test. And finally, a configuration property will be added using `@AddConfig` annotation.
118
127
119
128
[source,java]
120
129
.Code sample
121
130
----
122
-
@HelidonTest
123
-
@DisableDiscovery
124
-
@AddBean(MyBean.class)
125
-
@AddExtension(ConfigCdiExtension.class)
126
-
@AddConfig(key = "app.greeting", value = "TestHello")
131
+
@HelidonTest <1>
132
+
@DisableDiscovery <2>
133
+
@AddBean(MyBean.class) <3>
134
+
@AddExtension(ConfigCdiExtension.class) <4>
135
+
@AddConfig(key = "app.greeting", value = "TestHello") <5>
127
136
class TestExample {
128
137
@Inject
129
-
private MyBean myBean;
138
+
private MyBean myBean; <6>
130
139
131
140
@Test
132
-
void testGreeting() {
141
+
void testGreeting() { <7>
133
142
assertThat(myBean, notNullValue());
134
143
assertThat(myBean.greeting(), is("TestHello"));
135
144
}
136
145
}
137
146
----
147
+
<1> Start the Helidon container.
148
+
<2> Set disabled Bean Discovery for the current test class.
149
+
<3> Add `MyBean` to current context.
150
+
<4> Add a configuration CDI extension to the current test.
151
+
<5> Add configuration properties.
152
+
<6> Inject `MyBean` as it is available in the CDI context.
a|add JaxRs support to the test class. Only used with `@DisableDiscovery` annotation, otherwise an exception will be thrown. Automatically adds the following Beans and Extensions to the test class:
In current example Helidon container will be launched prior test. The _Bean Discovery_ will be disabled. _MyBean_ will be added to the test, so that it can be injected. _ConfigCdiExtension_ will be enabled for this test. And finally, a configuration property will be added using `@AddConfig` annotation.
134
+
In the current example, Helidon container will be launched prior test. The _Bean Discovery_ will be disabled. _MyBean_ will be added to the test, so that it can be injected. _ConfigCdiExtension_ will be enabled for this test. And finally, a configuration property will be added using `@AddConfig` annotation.
123
135
124
136
[source,java]
125
137
.Code sample
126
138
----
127
-
@HelidonTest
128
-
@DisableDiscovery
129
-
@AddBean(MyBean.class)
130
-
@AddExtension(ConfigCdiExtension.class)
131
-
@AddConfig(key = "app.greeting", value = "TestHello")
139
+
@HelidonTest <1>
140
+
@DisableDiscovery <2>
141
+
@AddBean(MyBean.class) <3>
142
+
@AddExtension(ConfigCdiExtension.class) <4>
143
+
@AddConfig(key = "app.greeting", value = "TestHello") <5>
132
144
class TestExample {
133
145
@Inject
134
-
private MyBean myBean;
146
+
private MyBean myBean; <6>
135
147
136
148
@Test
137
-
void testGreeting() {
149
+
void testGreeting() { <7>
138
150
assertThat(myBean, notNullValue());
139
151
assertThat(myBean.greeting(), is("TestHello"));
140
152
}
141
153
}
142
154
----
155
+
<1> Start the Helidon container.
156
+
<2> Set disabled Bean Discovery for the current test class.
157
+
<3> Add `MyBean` to current context.
158
+
<4> Add a configuration CDI extension to the current test.
159
+
<5> Add configuration properties.
160
+
<6> Inject `MyBean` as it is available in the CDI context.
0 commit comments