File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
mongodb/util/src/main/java/example/springdata/mongodb/util Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 4141import java .util .Map ;
4242import java .util .function .Function ;
4343
44+ import org .junit .AssumptionViolatedException ;
4445import org .junit .rules .ExternalResource ;
4546import org .slf4j .Logger ;
4647import org .slf4j .LoggerFactory ;
@@ -181,13 +182,24 @@ public EmbeddedMongo configure() {
181182 }
182183
183184 @ Override
184- protected void before () throws Throwable {
185- resource .start ();
185+ protected void before () {
186+
187+ try {
188+ resource .start ();
189+ } catch (RuntimeException e ) {
190+ LOGGER .error ("Cannot start MongoDB" , e );
191+ throw new AssumptionViolatedException ("Cannot start MongoDB. Skipping" , e );
192+ }
186193 }
187194
188195 @ Override
189196 protected void after () {
190- resource .stop ();
197+
198+ try {
199+ resource .stop ();
200+ } catch (RuntimeException e ) {
201+ LOGGER .error ("Cannot stop MongoDB" , e );
202+ }
191203 }
192204
193205 public MongoClient getMongoClient () {
You can’t perform that action at this time.
0 commit comments