### Question:
PrimingClient { public void primeBatch(BatchPrimingRequest batchPrimingRequest) throws PrimeFailedException { prime(batchPrimingRequest, primeBatchUrl); } private  PrimingClient(String host, int port); static PrimingClientBuilder builder(); void prime(PrimingRequest prime); void prime(PrimingRequest.PrimingRequestBuilder prime); void primeBatch(BatchPrimingRequest batchPrimingRequest); void primeBatch(BatchPrimingRequest.BatchPrimingRequestBuilder batchPrimingRequest); void multiPrime(MultiPrimeRequest primeRequest); @Deprecated void primeQuery(PrimingRequest primeRequest); @Deprecated void primePreparedStatement(PrimingRequest primeRequest); List<PrimingRequest> retrievePreparedPrimes(); List<MultiPrimeRequest> retrievePreparedMultiPrimes(); List<PrimingRequest> retrieveQueryPrimes(); void clearAllPrimes(); void clearQueryPrimes(); void clearPreparedPrimes(); void clearPreparedMultiPrimes(); void clearBatchPrimes(); static final String DELETING_OF_PRIMES_FAILED; static final String PRIMING_FAILED; }### Answer:
@Test public void testPrimeBatchWithQuery() throws Exception { stubFor(post(urlEqualTo(PRIME_BATCH_PATH)).willReturn(aResponse().withStatus(200))); underTest.primeBatch(BatchPrimingRequest.batchPrimingRequest() .withThen(BatchPrimingRequest .then() .withResult(Result.read_request_timeout) .build()) .withQueries( batchQueryPrime("select * from blah", BatchQueryKind.prepared_statement)) .build()); verify(postRequestedFor(urlEqualTo(PRIME_BATCH_PATH)) .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")) .withRequestBody(equalToJson("{\"when\": {\"queries\": [{\"text\":\"select * from blah\", " + "\"kind\":\"prepared_statement\"}], \"batchType\":\"LOGGED\" }," + "\"then\":{\"result\":\"read_request_timeout\"}}"))); }
@Test public void testPrimeBatchWithQueryWithCustomConfiguration() throws Exception { stubFor(post(urlEqualTo(PRIME_BATCH_PATH)).willReturn(aResponse().withStatus(200))); underTest.primeBatch(BatchPrimingRequest.batchPrimingRequest() .withThen(BatchPrimingRequest .then() .withResult(Result.write_request_timeout) .withConfig(new WriteTimeoutConfig(WriteTypePrime.BATCH, 0, 1)) .build()) .withQueries( batchQueryPrime("select * from blah", BatchQueryKind.prepared_statement)) .build()); verify(postRequestedFor(urlEqualTo(PRIME_BATCH_PATH)) .withHeader("Content-Type", equalTo("application/json; charset=UTF-8")) .withRequestBody(equalToJson("{ \"when\": { \"queries\": [ { \"text\": \"select * from blah\", " + "\"kind\": \"prepared_statement\"} ], \"batchType\": \"LOGGED\"}, \"then\": { " + "\"result\": \"write_request_timeout\", \"config\": { \"error.required_responses\": \"1\", " + "\"error.received_responses\": \"0\", \"error.write_type\": \"BATCH\"} } }"))); }