### Question:
IntegrityValidator { public void validateNodeRecord( NodeRecord record ) throws TransactionFailureException { if ( !record.inUse() && record.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue() ) { throw new ConstraintViolationTransactionFailureException( "Cannot delete node<" + record.getId() + ">, because it still has relationships. " + "To delete this node, you must first delete its relationships." ); } } IntegrityValidator( NeoStores neoStores, IndexingService indexes ); void validateNodeRecord( NodeRecord record ); void validateTransactionStartKnowledge( long lastCommittedTxWhenTransactionStarted ); void validateSchemaRule( SchemaRule schemaRule );  }### Answer:
@Test public void deletingNodeWithRelationshipsIsNotAllowed() { NeoStores store = mock( NeoStores.class ); IndexingService indexes = mock(IndexingService.class); IntegrityValidator validator = new IntegrityValidator( store, indexes ); NodeRecord record = new NodeRecord( 1L, false, 1L, -1L ); record.setInUse( false ); try { validator.validateNodeRecord( record ); fail( "Should have thrown integrity error." ); } catch ( Exception e ) { } }