CypherExecutor { Integer getTransactionId(String url) { Integer transactId = -1; if (url != null && url.contains(transactionUrl)) { String[] tab = url.split("/"); String last = tab[tab.length - 1]; try { transactId = Integer.valueOf(last); } catch (NumberFormatException e) { transactId = -1; } } return transactId; } CypherExecutor(String host, Integer port, Boolean secure, Properties properties); Neo4jResponse executeQueries(List<Neo4jStatement> queries); Neo4jResponse executeQuery(Neo4jStatement query); void commit(); void rollback(); Boolean getAutoCommit(); void setAutoCommit(Boolean autoCommit); String getServerVersion(); void close(); Integer getOpenTransactionId();  }
@Test public void getTransactionIdShouldReturnCorrectId() { Random idGenerator = new Random(); for (Integer i = 1; i < 100; i++) { Integer id = idGenerator.nextInt(); Integer returnId = executor.getTransactionId(executor.transactionUrl + "/" + id); Assert.assertEquals(id, returnId); } }
@Test public void getTransactionIdShouldReturnNegativeId() { List<String> urls = Arrays.asList("", "http: for (String url : urls) { Integer returnId = executor.getTransactionId(url); Assert.assertTrue(returnId < 0); } }