Search in sources :

Example 1 with StatementProcessor

use of org.neo4j.bolt.v1.runtime.StatementProcessor in project neo4j by neo4j.

the class BoltMatchers method hasTransaction.

public static Matcher<BoltStateMachine> hasTransaction() {
    return new BaseMatcher<BoltStateMachine>() {

        @Override
        public boolean matches(final Object item) {
            final BoltStateMachine machine = (BoltStateMachine) item;
            final StatementProcessor statementProcessor = machine.statementProcessor();
            return statementProcessor != null && statementProcessor.hasTransaction();
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("no transaction");
        }
    };
}
Also used : Description(org.hamcrest.Description) BaseMatcher(org.hamcrest.BaseMatcher) BoltStateMachine(org.neo4j.bolt.v1.runtime.BoltStateMachine) StatementProcessor(org.neo4j.bolt.v1.runtime.StatementProcessor)

Example 2 with StatementProcessor

use of org.neo4j.bolt.v1.runtime.StatementProcessor in project neo4j by neo4j.

the class BoltMatchers method hasNoTransaction.

public static Matcher<BoltStateMachine> hasNoTransaction() {
    return new BaseMatcher<BoltStateMachine>() {

        @Override
        public boolean matches(final Object item) {
            final BoltStateMachine machine = (BoltStateMachine) item;
            final StatementProcessor statementProcessor = machine.statementProcessor();
            return statementProcessor == null || !statementProcessor.hasTransaction();
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("no transaction");
        }
    };
}
Also used : Description(org.hamcrest.Description) BaseMatcher(org.hamcrest.BaseMatcher) BoltStateMachine(org.neo4j.bolt.v1.runtime.BoltStateMachine) StatementProcessor(org.neo4j.bolt.v1.runtime.StatementProcessor)

Aggregations

BaseMatcher (org.hamcrest.BaseMatcher)2 Description (org.hamcrest.Description)2 BoltStateMachine (org.neo4j.bolt.v1.runtime.BoltStateMachine)2 StatementProcessor (org.neo4j.bolt.v1.runtime.StatementProcessor)2