Search in sources :

Example 1 with ReportPhishingResponse

use of com.google.phishingprotection.v1beta1.ReportPhishingResponse in project java-phishingprotection by googleapis.

the class PhishingProtectionServiceV1Beta1ClientTest method reportPhishingTest.

@Test
public void reportPhishingTest() throws Exception {
    ReportPhishingResponse expectedResponse = ReportPhishingResponse.newBuilder().build();
    mockPhishingProtectionServiceV1Beta1.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    String uri = "uri116076";
    ReportPhishingResponse actualResponse = client.reportPhishing(parent, uri);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockPhishingProtectionServiceV1Beta1.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ReportPhishingRequest actualRequest = ((ReportPhishingRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(uri, actualRequest.getUri());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.phishingprotection.v1beta1.ProjectName) ReportPhishingResponse(com.google.phishingprotection.v1beta1.ReportPhishingResponse) ReportPhishingRequest(com.google.phishingprotection.v1beta1.ReportPhishingRequest) Test(org.junit.Test)

Example 2 with ReportPhishingResponse

use of com.google.phishingprotection.v1beta1.ReportPhishingResponse in project java-phishingprotection by googleapis.

the class PhishingProtectionServiceV1Beta1ClientTest method reportPhishingTest2.

@Test
public void reportPhishingTest2() throws Exception {
    ReportPhishingResponse expectedResponse = ReportPhishingResponse.newBuilder().build();
    mockPhishingProtectionServiceV1Beta1.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String uri = "uri116076";
    ReportPhishingResponse actualResponse = client.reportPhishing(parent, uri);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockPhishingProtectionServiceV1Beta1.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ReportPhishingRequest actualRequest = ((ReportPhishingRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(uri, actualRequest.getUri());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ReportPhishingResponse(com.google.phishingprotection.v1beta1.ReportPhishingResponse) ReportPhishingRequest(com.google.phishingprotection.v1beta1.ReportPhishingRequest) Test(org.junit.Test)

Aggregations

ReportPhishingRequest (com.google.phishingprotection.v1beta1.ReportPhishingRequest)2 ReportPhishingResponse (com.google.phishingprotection.v1beta1.ReportPhishingResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 ProjectName (com.google.phishingprotection.v1beta1.ProjectName)1