2020
2121import java .util .List ;
2222
23- import org .bson .Document ;
2423import org .junit .Test ;
2524import org .junit .runner .RunWith ;
2625
4039import org .springframework .integration .mongodb .rules .MongoDbAvailableTests ;
4140import org .springframework .messaging .Message ;
4241import 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 ;
4545
4646/**
4747 * @author Oleg Zhurakousky
5050 *
5151 * @since 2.2
5252 */
53- @ ContextConfiguration
54- @ RunWith (SpringJUnit4ClassRunner .class )
53+ @ RunWith (SpringRunner .class )
5554@ DirtiesContext
5655public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailableTests {
5756
@@ -102,7 +101,7 @@ public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailab
102101
103102 @ Test
104103 @ MongoDbAvailable
105- public void testWithDefaultMongoFactory () throws Exception {
104+ public void testWithDefaultMongoFactory () {
106105 this .mongoTemplate .save (createPerson ("Bob" ), "data" );
107106
108107 this .mongoInboundAdapter .start ();
@@ -119,13 +118,13 @@ public void testWithDefaultMongoFactory() throws Exception {
119118
120119 @ Test
121120 @ MongoDbAvailable
122- public void testWithNamedMongoFactory () throws Exception {
121+ public void testWithNamedMongoFactory () {
123122 this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
124123
125124 this .mongoInboundAdapterNamedFactory .start ();
126125
127126 @ SuppressWarnings ("unchecked" )
128- Message <List <Document >> message = (Message <List <Document >>) replyChannel .receive (10000 );
127+ Message <List <BasicDBObject >> message = (Message <List <BasicDBObject >>) replyChannel .receive (10000 );
129128 assertThat (message ).isNotNull ();
130129 assertThat (message .getPayload ().get (0 ).get ("name" )).isEqualTo ("Bob" );
131130
@@ -135,7 +134,7 @@ public void testWithNamedMongoFactory() throws Exception {
135134
136135 @ Test
137136 @ MongoDbAvailable
138- public void testWithMongoTemplate () throws Exception {
137+ public void testWithMongoTemplate () {
139138 this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
140139
141140 this .mongoInboundAdapterWithTemplate .start ();
@@ -151,7 +150,7 @@ public void testWithMongoTemplate() throws Exception {
151150
152151 @ Test
153152 @ MongoDbAvailable
154- public void testWithNamedCollection () throws Exception {
153+ public void testWithNamedCollection () {
155154 this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
156155
157156 this .mongoInboundAdapterWithNamedCollection .start ();
@@ -167,7 +166,7 @@ public void testWithNamedCollection() throws Exception {
167166
168167 @ Test
169168 @ MongoDbAvailable
170- public void testWithQueryExpression () throws Exception {
169+ public void testWithQueryExpression () {
171170 this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
172171 this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
173172 this .mongoInboundAdapterWithQueryExpression .start ();
@@ -181,7 +180,7 @@ public void testWithQueryExpression() throws Exception {
181180
182181 @ Test
183182 @ MongoDbAvailable
184- public void testWithStringQueryExpression () throws Exception {
183+ public void testWithStringQueryExpression () {
185184 this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
186185 this .mongoInboundAdapterWithStringQueryExpression .start ();
187186 @ SuppressWarnings ("unchecked" )
@@ -193,7 +192,7 @@ public void testWithStringQueryExpression() throws Exception {
193192
194193 @ Test
195194 @ MongoDbAvailable
196- public void testWithNamedCollectionExpression () throws Exception {
195+ public void testWithNamedCollectionExpression () {
197196 this .mongoTemplate .save (this .createPerson ("Bob" ), "foo" );
198197
199198 this .mongoInboundAdapterWithNamedCollectionExpression .start ();
@@ -209,7 +208,7 @@ public void testWithNamedCollectionExpression() throws Exception {
209208
210209 @ Test
211210 @ MongoDbAvailable
212- public void testWithOnSuccessDisposition () throws Exception {
211+ public void testWithOnSuccessDisposition () {
213212 this .mongoTemplate .save (createPerson ("Bob" ), "data" );
214213
215214 this .inboundAdapterWithOnSuccessDisposition .start ();
@@ -227,7 +226,7 @@ public void testWithOnSuccessDisposition() throws Exception {
227226
228227 @ Test
229228 @ MongoDbAvailable
230- public void testWithMongoConverter () throws Exception {
229+ public void testWithMongoConverter () {
231230 this .mongoTemplate .save (this .createPerson ("Bob" ), "data" );
232231
233232 this .mongoInboundAdapterWithConverter .start ();
@@ -244,25 +243,25 @@ public void testWithMongoConverter() throws Exception {
244243
245244 @ Test (expected = BeanDefinitionParsingException .class )
246245 @ MongoDbAvailable
247- public void testFailureWithQueryAndQueryExpression () throws Exception {
246+ public void testFailureWithQueryAndQueryExpression () {
248247 new ClassPathXmlApplicationContext ("inbound-fail-q-qex.xml" , this .getClass ()).close ();
249248 }
250249
251250 @ Test (expected = BeanDefinitionParsingException .class )
252251 @ MongoDbAvailable
253- public void testFailureWithFactoryAndTemplate () throws Exception {
252+ public void testFailureWithFactoryAndTemplate () {
254253 new ClassPathXmlApplicationContext ("inbound-fail-factory-template.xml" , this .getClass ()).close ();
255254 }
256255
257256 @ Test (expected = BeanDefinitionParsingException .class )
258257 @ MongoDbAvailable
259- public void testFailureWithCollectionAndCollectionExpression () throws Exception {
258+ public void testFailureWithCollectionAndCollectionExpression () {
260259 new ClassPathXmlApplicationContext ("inbound-fail-c-cex.xml" , this .getClass ()).close ();
261260 }
262261
263262 @ Test (expected = BeanDefinitionParsingException .class )
264263 @ MongoDbAvailable
265- public void testFailureWithTemplateAndConverter () throws Exception {
264+ public void testFailureWithTemplateAndConverter () {
266265 new ClassPathXmlApplicationContext ("inbound-fail-converter-template.xml" , this .getClass ()).close ();
267266 }
268267
0 commit comments