20
20
21
21
import java .util .List ;
22
22
23
- import org .bson .Document ;
24
23
import org .junit .Test ;
25
24
import org .junit .runner .RunWith ;
26
25
40
39
import org .springframework .integration .mongodb .rules .MongoDbAvailableTests ;
41
40
import org .springframework .messaging .Message ;
42
41
import org .springframework .test .annotation .DirtiesContext ;
43
- import org .springframework .test .context .ContextConfiguration ;
44
- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
42
+ import org .springframework .test .context .junit4 .SpringRunner ;
43
+
44
+ import com .mongodb .BasicDBObject ;
45
45
46
46
/**
47
47
* @author Oleg Zhurakousky
50
50
*
51
51
* @since 2.2
52
52
*/
53
- @ ContextConfiguration
54
- @ RunWith (SpringJUnit4ClassRunner .class )
53
+ @ RunWith (SpringRunner .class )
55
54
@ DirtiesContext
56
55
public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailableTests {
57
56
@@ -102,7 +101,7 @@ public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailab
102
101
103
102
@ Test
104
103
@ MongoDbAvailable
105
- public void testWithDefaultMongoFactory () throws Exception {
104
+ public void testWithDefaultMongoFactory () {
106
105
this .mongoTemplate .save (createPerson ("Bob" ), "data" );
107
106
108
107
this .mongoInboundAdapter .start ();
@@ -119,13 +118,13 @@ public void testWithDefaultMongoFactory() throws Exception {
119
118
120
119
@ Test
121
120
@ MongoDbAvailable
122
- public void testWithNamedMongoFactory () throws Exception {
121
+ public void testWithNamedMongoFactory () {
123
122
this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
124
123
125
124
this .mongoInboundAdapterNamedFactory .start ();
126
125
127
126
@ SuppressWarnings ("unchecked" )
128
- Message <List <Document >> message = (Message <List <Document >>) replyChannel .receive (10000 );
127
+ Message <List <BasicDBObject >> message = (Message <List <BasicDBObject >>) replyChannel .receive (10000 );
129
128
assertThat (message ).isNotNull ();
130
129
assertThat (message .getPayload ().get (0 ).get ("name" )).isEqualTo ("Bob" );
131
130
@@ -135,7 +134,7 @@ public void testWithNamedMongoFactory() throws Exception {
135
134
136
135
@ Test
137
136
@ MongoDbAvailable
138
- public void testWithMongoTemplate () throws Exception {
137
+ public void testWithMongoTemplate () {
139
138
this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
140
139
141
140
this .mongoInboundAdapterWithTemplate .start ();
@@ -151,7 +150,7 @@ public void testWithMongoTemplate() throws Exception {
151
150
152
151
@ Test
153
152
@ MongoDbAvailable
154
- public void testWithNamedCollection () throws Exception {
153
+ public void testWithNamedCollection () {
155
154
this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
156
155
157
156
this .mongoInboundAdapterWithNamedCollection .start ();
@@ -167,7 +166,7 @@ public void testWithNamedCollection() throws Exception {
167
166
168
167
@ Test
169
168
@ MongoDbAvailable
170
- public void testWithQueryExpression () throws Exception {
169
+ public void testWithQueryExpression () {
171
170
this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
172
171
this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
173
172
this .mongoInboundAdapterWithQueryExpression .start ();
@@ -181,7 +180,7 @@ public void testWithQueryExpression() throws Exception {
181
180
182
181
@ Test
183
182
@ MongoDbAvailable
184
- public void testWithStringQueryExpression () throws Exception {
183
+ public void testWithStringQueryExpression () {
185
184
this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
186
185
this .mongoInboundAdapterWithStringQueryExpression .start ();
187
186
@ SuppressWarnings ("unchecked" )
@@ -193,7 +192,7 @@ public void testWithStringQueryExpression() throws Exception {
193
192
194
193
@ Test
195
194
@ MongoDbAvailable
196
- public void testWithNamedCollectionExpression () throws Exception {
195
+ public void testWithNamedCollectionExpression () {
197
196
this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
198
197
199
198
this .mongoInboundAdapterWithNamedCollectionExpression .start ();
@@ -209,7 +208,7 @@ public void testWithNamedCollectionExpression() throws Exception {
209
208
210
209
@ Test
211
210
@ MongoDbAvailable
212
- public void testWithOnSuccessDisposition () throws Exception {
211
+ public void testWithOnSuccessDisposition () {
213
212
this .mongoTemplate .save (createPerson ("Bob" ), "data" );
214
213
215
214
this .inboundAdapterWithOnSuccessDisposition .start ();
@@ -227,7 +226,7 @@ public void testWithOnSuccessDisposition() throws Exception {
227
226
228
227
@ Test
229
228
@ MongoDbAvailable
230
- public void testWithMongoConverter () throws Exception {
229
+ public void testWithMongoConverter () {
231
230
this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
232
231
233
232
this .mongoInboundAdapterWithConverter .start ();
@@ -244,25 +243,25 @@ public void testWithMongoConverter() throws Exception {
244
243
245
244
@ Test (expected = BeanDefinitionParsingException .class )
246
245
@ MongoDbAvailable
247
- public void testFailureWithQueryAndQueryExpression () throws Exception {
246
+ public void testFailureWithQueryAndQueryExpression () {
248
247
new ClassPathXmlApplicationContext ("inbound-fail-q-qex.xml" , this .getClass ()).close ();
249
248
}
250
249
251
250
@ Test (expected = BeanDefinitionParsingException .class )
252
251
@ MongoDbAvailable
253
- public void testFailureWithFactoryAndTemplate () throws Exception {
252
+ public void testFailureWithFactoryAndTemplate () {
254
253
new ClassPathXmlApplicationContext ("inbound-fail-factory-template.xml" , this .getClass ()).close ();
255
254
}
256
255
257
256
@ Test (expected = BeanDefinitionParsingException .class )
258
257
@ MongoDbAvailable
259
- public void testFailureWithCollectionAndCollectionExpression () throws Exception {
258
+ public void testFailureWithCollectionAndCollectionExpression () {
260
259
new ClassPathXmlApplicationContext ("inbound-fail-c-cex.xml" , this .getClass ()).close ();
261
260
}
262
261
263
262
@ Test (expected = BeanDefinitionParsingException .class )
264
263
@ MongoDbAvailable
265
- public void testFailureWithTemplateAndConverter () throws Exception {
264
+ public void testFailureWithTemplateAndConverter () {
266
265
new ClassPathXmlApplicationContext ("inbound-fail-converter-template.xml" , this .getClass ()).close ();
267
266
}
268
267
0 commit comments