Skip to content

Commit

Permalink
DATAMONGO-1559 - Drop collections used in ReactiveMongoTemplateExecut…
Browse files Browse the repository at this point in the history
…eTests before tests.

We now drop the collections used in ReactiveMongoTemplateExecuteTests on test start to create a clean state for the tests. Previously, collections were dropped after the tests only so existing data in the collections could interfere with the tests themselves.
  • Loading branch information
mp911de committed Mar 27, 2017
1 parent 6bc72a6 commit e9da449
Showing 1 changed file with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.springframework.data.mongodb.core;

import static com.sun.prism.impl.Disposer.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
Expand All @@ -24,7 +23,6 @@
import reactor.test.StepVerifier;

import org.bson.Document;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -62,7 +60,13 @@ public class ReactiveMongoTemplateExecuteTests {

@Before
public void setUp() {
cleanUp();

Flux<Void> cleanup = operations.dropCollection("person") //
.mergeWith(operations.dropCollection("execute_test")) //
.mergeWith(operations.dropCollection("execute_test1")) //
.mergeWith(operations.dropCollection("execute_test2"));

StepVerifier.create(cleanup).verifyComplete();

if (mongoVersion == null) {
mongoVersion = operations.executeCommand("{ buildInfo: 1 }") //
Expand All @@ -72,19 +76,6 @@ public void setUp() {
}
}

@After
public void tearDown() {

Flux<Void> cleanup = operations.dropCollection("person") //
.mergeWith(operations.dropCollection(Person.class)) //
.mergeWith(operations.dropCollection("execute_test")) //
.mergeWith(operations.dropCollection("execute_test1")) //
.mergeWith(operations.dropCollection("execute_test2")) //
.mergeWith(operations.dropCollection("execute_index_test"));

StepVerifier.create(cleanup).verifyComplete();
}

@Test // DATAMONGO-1444
public void executeCommandJsonCommandShouldReturnSingleResponse() {

Expand Down

0 comments on commit e9da449

Please sign in to comment.