@Before public void setup() throws Exception { databaseDirectory = createTempDir(); dbFactory = mock(LifecycleManagingDatabase.GraphFactory.class); when(dbFactory.newGraphDatabase(any(String.class), any(Map.class), any(Dependencies.class))) .thenReturn(dbRule.getGraphDatabaseAPI()); theDatabase = newDatabase(); }