use of com.google.recaptchaenterprise.v1.CreateAssessmentRequest in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceClientTest method createAssessmentTest2.
@Test
public void createAssessmentTest2() throws Exception {
Assessment expectedResponse = Assessment.newBuilder().setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()).setEvent(Event.newBuilder().build()).setRiskAnalysis(RiskAnalysis.newBuilder().build()).setTokenProperties(TokenProperties.newBuilder().build()).setAccountDefenderAssessment(AccountDefenderAssessment.newBuilder().build()).build();
mockRecaptchaEnterpriseService.addResponse(expectedResponse);
String parent = "parent-995424086";
Assessment assessment = Assessment.newBuilder().build();
Assessment actualResponse = client.createAssessment(parent, assessment);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockRecaptchaEnterpriseService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateAssessmentRequest actualRequest = ((CreateAssessmentRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(assessment, actualRequest.getAssessment());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations