Search in sources :

Example 1 with EmbedMongoDB

use of com.mongodb.EmbedMongoDB in project embedmongo-maven-plugin by joelittlejohn.

the class MongoScriptsMojoTest method should_fail_to_execute_instruction_with_error.

@Test
public void should_fail_to_execute_instruction_with_error() throws IOException, MojoFailureException, MojoExecutionException {
    DB database = mock(DB.class);
    initFolderWithError();
    CommandResult result = new EmbedMongoDB("myDB").notOkErrorResult("Error while executing instructions from file '" + rootFolderWithError.listFiles()[0].getName());
    given(database.doEval(anyString(), Matchers.<Object>anyVararg())).willReturn(result);
    thrown.expect(MojoExecutionException.class);
    thrown.expectMessage("Error while executing instructions from file '" + rootFolderWithError.listFiles()[0].getName());
    new MongoScriptsMojoForTest(rootFolderWithError, PORT, "myDB", database, null).execute();
}
Also used : EmbedMongoDB(com.mongodb.EmbedMongoDB) DB(com.mongodb.DB) EmbedMongoDB(com.mongodb.EmbedMongoDB) CommandResult(com.mongodb.CommandResult) Test(org.junit.Test)

Aggregations

CommandResult (com.mongodb.CommandResult)1 DB (com.mongodb.DB)1 EmbedMongoDB (com.mongodb.EmbedMongoDB)1 Test (org.junit.Test)1