Skip to content

Commit 0b5231b

Browse files
author
Vasile Baluta
committed
add print of stack trace
1 parent 2e1ae16 commit 0b5231b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/test/java/com/ericsson/ei/handlers/test/ObjectHandlerTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ public class ObjectHandlerTest {
6969
private String event = "{\"meta\":{\"id\":\"eventId\"}}";
7070

7171
public void setUpEmbeddedMongo() throws Exception {
72-
testsFactory = MongodForTestsFactory.with(Version.V3_4_1);
73-
mongoClient = testsFactory.newMongo();
72+
try {
73+
testsFactory = MongodForTestsFactory.with(Version.V3_4_1);
74+
mongoClient = testsFactory.newMongo();
75+
} catch (Exception e) {
76+
log.error(e.getMessage(), e);
77+
e.printStackTrace();
78+
}
79+
7480
}
7581

7682
@Before

src/test/java/com/ericsson/ei/subscription/SubscriptionServiceTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@
3333
import org.junit.BeforeClass;
3434
import org.junit.Test;
3535
import org.junit.runner.RunWith;
36+
import org.slf4j.Logger;
37+
import org.slf4j.LoggerFactory;
3638
import org.springframework.beans.factory.annotation.Autowired;
3739
import org.springframework.boot.test.context.SpringBootTest;
3840
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
3941

4042
import com.ericsson.ei.App;
4143
import com.ericsson.ei.controller.model.Subscription;
4244
import com.ericsson.ei.exception.SubscriptionNotFoundException;
45+
import com.ericsson.ei.handlers.test.ObjectHandlerTest;
4346
import com.ericsson.ei.mongodbhandler.MongoDBHandler;
4447
import com.ericsson.ei.services.ISubscriptionService;
4548
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -52,6 +55,8 @@
5255
@SpringBootTest(classes = App.class)
5356
public class SubscriptionServiceTest {
5457

58+
final static Logger LOGGER = (Logger) LoggerFactory.getLogger(SubscriptionServiceTest.class);
59+
5560
String subscriptionName;
5661

5762
@Autowired
@@ -71,7 +76,12 @@ public class SubscriptionServiceTest {
7176

7277
@BeforeClass
7378
public static void setMongoDB() throws IOException, JSONException {
74-
testsFactory = MongodForTestsFactory.with(Version.V3_4_1);
79+
try {
80+
testsFactory = MongodForTestsFactory.with(Version.V3_4_1);
81+
} catch (Exception e) {
82+
LOGGER.error(e.getMessage(), e);
83+
e.printStackTrace();
84+
}
7585
String readFileToString = FileUtils.readFileToString(new File(subscriptionJsonPath), "UTF-8");
7686
jsonArray = new JSONArray(readFileToString);
7787
mongoClient = testsFactory.newMongo();

0 commit comments

Comments
 (0)