From 41e8fc46aa4611d893f196c004eea2942a1f7083 Mon Sep 17 00:00:00 2001 From: asgar Date: Thu, 20 Sep 2018 18:46:39 +0530 Subject: exception scenario covered in AAIGraphTest.java Change-Id: I63009b10aec1e1a73348eaeaa536b1a64dcc11b8 Issue-ID: AAI-1662 Signed-off-by: Mohamed Asgar Samiulla --- aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'aai-core/src') diff --git a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java index 52319709..5915ce68 100644 --- a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java +++ b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java @@ -31,6 +31,8 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.Assert.*; +import java.io.FileNotFoundException; + public class AAIGraphTest extends AAISetup{ @Before public void setup() { @@ -68,5 +70,15 @@ public class AAIGraphTest extends AAISetup{ graphMgt.rollback(); graph.close(); } + + @Test (expected=FileNotFoundException.class) + public void JanusGraphOpenNameWithInvalidFilePathTest() throws Exception{ + JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder("invalid").forService(SERVICE_NAME).withGraphType("graphType").buildConfiguration()); + JanusGraphManagement graphMgt = graph.openManagement(); + String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); + assertThat(connectionInstanceName,matchesPattern("^\\d+_[\\w\\-\\d]+_" + SERVICE_NAME + "_graphType_\\d+\\(current\\)$")); + graphMgt.rollback(); + graph.close(); + } } -- cgit 1.2.3-korg