@Override protected boolean matchesSafely( Iterable<T> objects ) { return itemsMatches( toMatch, objects ); }
public PropertyValueMatcher withValue( Object value ) { return new PropertyValueMatcher( this, propertyName, value ); } }
public static IndexDefinition createIndex( GraphDatabaseService beansAPI, Label label, String... properties ) { IndexDefinition indexDef = createIndexNoWait( beansAPI, label, properties ); waitForIndex( beansAPI, indexDef ); return indexDef; }
@Test public void setSingleProperty() throws Exception { BatchInserter inserter = newBatchInserter(); long node = inserter.createNode( null ); String value = "Something"; String key = "name"; inserter.setNodeProperty( node, key, value ); GraphDatabaseService db = switchToEmbeddedGraphDatabaseService( inserter ); assertThat( getNodeInTx( node, db ), inTx( db, hasProperty( key ).withValue( value ) ) ); db.shutdown(); }
@Test public void addingAnIndexingRuleShouldSucceed() { // WHEN IndexDefinition index = createIndex( db, label, propertyKey ); // THEN assertThat( getIndexes( db, label ), containsOnly( index ) ); }
public static <T> Matcher<? super T> inTx( final GraphDatabaseService db, final Matcher<T> inner ) { return inTx( db, inner, false ); }
public static TypeSafeDiagnosingMatcher<Node> hasNoLabels() { return hasLabels( emptySet() ); }
@Override protected boolean matchesSafely( PropertyContainer propertyContainer, Description mismatchDescription ) { if ( !propertyMatcher.matchesSafely( propertyContainer, mismatchDescription ) ) { return false; } Object foundValue = propertyContainer.getProperty( propertyName ); if ( !propertyValuesEqual( expectedValue, foundValue ) ) { mismatchDescription.appendText( "found value " + formatValue( foundValue ) ); return false; } return true; }
@Override public void describeTo( Description description ) { propertyMatcher.describeTo( description ); description.appendText( String.format( "having value %s", formatValue( expectedValue ) ) ); }
public static List<LogEntry> logEntries( FileSystemAbstraction fileSystem, File file ) throws IOException { return logEntries( fileSystem, file.getPath() ); }
public static <T> CollectionMatcher<T> matchesCollection( Collection<T> toMatch ) { return new CollectionMatcher<>( toMatch ); }
public static <T> IterableMatcher<T> matchesIterable( Iterable<T> toMatch ) { return new IterableMatcher<>( toMatch ); } }
public static PropertyMatcher hasProperty( String propertyName ) { return new PropertyMatcher( propertyName ); }
public static Matcher<String> pattern( String regex ) { return new RegexMatcher( Pattern.compile( regex ) ); }
public Collection<T> collection() { try ( Transaction ignore = db.beginTx() ) { return Iterables.asCollection( manifest() ); } }
@Test public void addingACompositeIndexingRuleShouldSucceed() { // WHEN IndexDefinition index = createIndex( db, label, propertyKey, secondPropertyKey ); // THEN assertThat( getIndexes( db, label ), containsOnly( index ) ); }
public <T> Matcher<? super T> inTxS( final Matcher<T> inner ) { return inTx( db, inner, false ); }
public static TypeSafeDiagnosingMatcher<Node> hasLabels( String... expectedLabels ) { return hasLabels( asSet( expectedLabels ) ); }
@Override protected boolean matchesSafely( Collection<T> objects ) { return IterableMatcher.itemsMatches( toMatch, objects ); }
@SafeVarargs public static <T> CollectionMatcher<T> matchesCollection( T... toMatch ) { return new CollectionMatcher<>( asList( toMatch ) ); } }