@Test public void should_use_default_cql_version() { CqlExecCassandraMojo cqlExecCassandraMojo = builder.cqlStatement(CQL_STATEMENT).build(); ArgumentCaptor<ThriftApiOperation> operation = mockThriftExecution(); try { cqlExecCassandraMojo.execute(); assertEquals("3.4.0", operation.getValue().getCqlVersion()); } catch (MojoExecutionException | MojoFailureException e) { fail(e.getMessage()); } }
@Test public void should_fail_when_request_fails() { CqlExecCassandraMojo cqlExecCassandraMojo = builder.cqlStatement(CQL_STATEMENT).build(); mockThriftExecutionWith( new ThrowsException( new ThriftApiExecutionException(new InvalidRequestException("bad statement")))); try { cqlExecCassandraMojo.execute(); fail(); } catch (MojoExecutionException e) { assertEquals( "There was a problem calling Apache Cassandra's Thrift API. Details: The request was not properly formatted bad statement", e.getMessage()); } catch (MojoFailureException e) { fail(e.getMessage()); } }