title: JUnit - @DirtyContext not reset neo4j database after each test method
body: <p>I'm using <code>Spring 4.3.3.RELEASE</code>, <code>Hibernate 5.0.11.Final</code>, <code>JUnit 4.1.2</code>, <code>SDN4.1.3-RELEASE</code> and <code>neo4j-ogm-2.0.5</code>. I read and try to implement <code>@DirtyContext</code> that can reset my Database after each test method finish running. But When I look at my Database, All nodes that i created in Test method still there.</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringBootTest(classes = MockApplication.class)
  @ContextConfiguration(classes = TestConfig.class)
  @DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
  public class OrderServiceTest {
  
      @Autowired
      private OrderService orderService;
  
      @Autowired
      private CustomerService customerService;
  
      @Autowired
      private TableService tableService;
  
      @Test
      public void orderMenuFoodAndDrink() throws Exception {
          Customer customer = new Customer();
          customer.setName("Customer 1");
          customerService.save(customer);
  
          Table table = new Table ();
          table.setCustomer(customer);
          tableService.save(table);
  
          ObjectResult result = orderService.orderTable(customer.getId());
  
          assertThat(result.getTables().get(0), is(table`enter code here`));
      }
  }
  </code></pre>
  
  <p>And this is How I set my Configuration Context with Java Annotation</p>
  
  <pre><code>@Configuration
  public class TestConfig {
  
      @Primary
      @Bean
      public OrderService OrderService() {
          OrderService OrderService = new OrderServiceImpl();
          return OrderService;
      }
  }
  </code></pre>
  
  <p><code>OrderService</code> is my Interface Class, and <code>OrderServiceImpl</code> is my Service Implementation. I have two references, but all of those is not working, because when I look at my database, all nodes still there, not deleted</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/14343893/how-do-i-reset-my-database-state-after-each-unit-test-without-making-the-whole-t">Reference</a></li>
  <li><a href="https://stackoverflow.com/questions/24854527/run-all-junit-tests-indepentently-in-eclipse-reloading-spring-context-each-time">Reference</a></li>
  </ol>