text:
package com.google.cloud.video.stitcher.v1;

import static com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient.ListCdnKeysPagedResponse;
import static com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient.ListLiveAdTagDetailsPagedResponse;
import static com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient.ListSlatesPagedResponse;
import static com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient.ListVodAdTagDetailsPagedResponse;
import static com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient.ListVodStitchDetailsPagedResponse;

import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

@Generated("by gapic-generator-java")
public class VideoStitcherServiceClientTest {
  private static MockServiceHelper mockServiceHelper;
  private static MockVideoStitcherService mockVideoStitcherService;
  private LocalChannelProvider channelProvider;
  private VideoStitcherServiceClient client;

  @BeforeClass
  public static void startStaticServer() {
    mockVideoStitcherService = new MockVideoStitcherService();
    mockServiceHelper =
        new MockServiceHelper(
            UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockVideoStitcherService));
    mockServiceHelper.start();
  }

  @AfterClass
  public static void stopServer() {
    mockServiceHelper.stop();
  }

  @Before
  public void setUp() throws IOException {
    mockServiceHelper.reset();
    channelProvider = mockServiceHelper.createChannelProvider();
    VideoStitcherServiceSettings settings =
        VideoStitcherServiceSettings.newBuilder()
            .setTransportChannelProvider(channelProvider)
            .setCredentialsProvider(NoCredentialsProvider.create())
            .build();
    client = VideoStitcherServiceClient.create(settings);
  }

  @After
  public void tearDown() throws Exception {
    client.close();
  }

  @Test
  public void createCdnKeyTest() throws Exception {
    CdnKey expectedResponse =
        CdnKey.newBuilder()
            .setName(CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]").toString())
            .setHostname("hostname-299803597")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    CdnKey cdnKey = CdnKey.newBuilder().build();
    String cdnKeyId = "cdnKeyId-1777782867";

    CdnKey actualResponse = client.createCdnKey(parent, cdnKey, cdnKeyId);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateCdnKeyRequest actualRequest = ((CreateCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(cdnKey, actualRequest.getCdnKey());
    Assert.assertEquals(cdnKeyId, actualRequest.getCdnKeyId());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createCdnKeyExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
      CdnKey cdnKey = CdnKey.newBuilder().build();
      String cdnKeyId = "cdnKeyId-1777782867";
      client.createCdnKey(parent, cdnKey, cdnKeyId);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createCdnKeyTest2() throws Exception {
    CdnKey expectedResponse =
        CdnKey.newBuilder()
            .setName(CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]").toString())
            .setHostname("hostname-299803597")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";
    CdnKey cdnKey = CdnKey.newBuilder().build();
    String cdnKeyId = "cdnKeyId-1777782867";

    CdnKey actualResponse = client.createCdnKey(parent, cdnKey, cdnKeyId);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateCdnKeyRequest actualRequest = ((CreateCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(cdnKey, actualRequest.getCdnKey());
    Assert.assertEquals(cdnKeyId, actualRequest.getCdnKeyId());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createCdnKeyExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      CdnKey cdnKey = CdnKey.newBuilder().build();
      String cdnKeyId = "cdnKeyId-1777782867";
      client.createCdnKey(parent, cdnKey, cdnKeyId);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listCdnKeysTest() throws Exception {
    CdnKey responsesElement = CdnKey.newBuilder().build();
    ListCdnKeysResponse expectedResponse =
        ListCdnKeysResponse.newBuilder()
            .setNextPageToken("")
            .addAllCdnKeys(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");

    ListCdnKeysPagedResponse pagedListResponse = client.listCdnKeys(parent);

    List<CdnKey> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCdnKeysList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCdnKeysRequest actualRequest = ((ListCdnKeysRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listCdnKeysExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
      client.listCdnKeys(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listCdnKeysTest2() throws Exception {
    CdnKey responsesElement = CdnKey.newBuilder().build();
    ListCdnKeysResponse expectedResponse =
        ListCdnKeysResponse.newBuilder()
            .setNextPageToken("")
            .addAllCdnKeys(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";

    ListCdnKeysPagedResponse pagedListResponse = client.listCdnKeys(parent);

    List<CdnKey> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCdnKeysList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCdnKeysRequest actualRequest = ((ListCdnKeysRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listCdnKeysExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      client.listCdnKeys(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getCdnKeyTest() throws Exception {
    CdnKey expectedResponse =
        CdnKey.newBuilder()
            .setName(CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]").toString())
            .setHostname("hostname-299803597")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    CdnKeyName name = CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]");

    CdnKey actualResponse = client.getCdnKey(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetCdnKeyRequest actualRequest = ((GetCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getCdnKeyExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      CdnKeyName name = CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]");
      client.getCdnKey(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getCdnKeyTest2() throws Exception {
    CdnKey expectedResponse =
        CdnKey.newBuilder()
            .setName(CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]").toString())
            .setHostname("hostname-299803597")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    CdnKey actualResponse = client.getCdnKey(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetCdnKeyRequest actualRequest = ((GetCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getCdnKeyExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getCdnKey(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void deleteCdnKeyTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockVideoStitcherService.addResponse(expectedResponse);

    CdnKeyName name = CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]");

    client.deleteCdnKey(name);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteCdnKeyRequest actualRequest = ((DeleteCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void deleteCdnKeyExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      CdnKeyName name = CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]");
      client.deleteCdnKey(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void deleteCdnKeyTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    client.deleteCdnKey(name);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteCdnKeyRequest actualRequest = ((DeleteCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void deleteCdnKeyExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.deleteCdnKey(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void updateCdnKeyTest() throws Exception {
    CdnKey expectedResponse =
        CdnKey.newBuilder()
            .setName(CdnKeyName.of("[PROJECT]", "[LOCATION]", "[CDN_KEY]").toString())
            .setHostname("hostname-299803597")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    CdnKey cdnKey = CdnKey.newBuilder().build();
    FieldMask updateMask = FieldMask.newBuilder().build();

    CdnKey actualResponse = client.updateCdnKey(cdnKey, updateMask);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateCdnKeyRequest actualRequest = ((UpdateCdnKeyRequest) actualRequests.get(0));

    Assert.assertEquals(cdnKey, actualRequest.getCdnKey());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void updateCdnKeyExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      CdnKey cdnKey = CdnKey.newBuilder().build();
      FieldMask updateMask = FieldMask.newBuilder().build();
      client.updateCdnKey(cdnKey, updateMask);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createVodSessionTest() throws Exception {
    VodSession expectedResponse =
        VodSession.newBuilder()
            .setName(VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]").toString())
            .setInterstitials(Interstitials.newBuilder().build())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setAdTagUri("adTagUri-1692450443")
            .putAllAdTagMacroMap(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setAssetId("assetId-704776149")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    VodSession vodSession = VodSession.newBuilder().build();

    VodSession actualResponse = client.createVodSession(parent, vodSession);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateVodSessionRequest actualRequest = ((CreateVodSessionRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(vodSession, actualRequest.getVodSession());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createVodSessionExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
      VodSession vodSession = VodSession.newBuilder().build();
      client.createVodSession(parent, vodSession);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createVodSessionTest2() throws Exception {
    VodSession expectedResponse =
        VodSession.newBuilder()
            .setName(VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]").toString())
            .setInterstitials(Interstitials.newBuilder().build())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setAdTagUri("adTagUri-1692450443")
            .putAllAdTagMacroMap(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setAssetId("assetId-704776149")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";
    VodSession vodSession = VodSession.newBuilder().build();

    VodSession actualResponse = client.createVodSession(parent, vodSession);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateVodSessionRequest actualRequest = ((CreateVodSessionRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(vodSession, actualRequest.getVodSession());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createVodSessionExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      VodSession vodSession = VodSession.newBuilder().build();
      client.createVodSession(parent, vodSession);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodSessionTest() throws Exception {
    VodSession expectedResponse =
        VodSession.newBuilder()
            .setName(VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]").toString())
            .setInterstitials(Interstitials.newBuilder().build())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setAdTagUri("adTagUri-1692450443")
            .putAllAdTagMacroMap(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setAssetId("assetId-704776149")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    VodSessionName name = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");

    VodSession actualResponse = client.getVodSession(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodSessionRequest actualRequest = ((GetVodSessionRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodSessionExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      VodSessionName name = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");
      client.getVodSession(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodSessionTest2() throws Exception {
    VodSession expectedResponse =
        VodSession.newBuilder()
            .setName(VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]").toString())
            .setInterstitials(Interstitials.newBuilder().build())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setAdTagUri("adTagUri-1692450443")
            .putAllAdTagMacroMap(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setAssetId("assetId-704776149")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    VodSession actualResponse = client.getVodSession(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodSessionRequest actualRequest = ((GetVodSessionRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodSessionExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getVodSession(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listVodStitchDetailsTest() throws Exception {
    VodStitchDetail responsesElement = VodStitchDetail.newBuilder().build();
    ListVodStitchDetailsResponse expectedResponse =
        ListVodStitchDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllVodStitchDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    VodSessionName parent = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");

    ListVodStitchDetailsPagedResponse pagedListResponse = client.listVodStitchDetails(parent);

    List<VodStitchDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getVodStitchDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListVodStitchDetailsRequest actualRequest =
        ((ListVodStitchDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listVodStitchDetailsExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      VodSessionName parent = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");
      client.listVodStitchDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listVodStitchDetailsTest2() throws Exception {
    VodStitchDetail responsesElement = VodStitchDetail.newBuilder().build();
    ListVodStitchDetailsResponse expectedResponse =
        ListVodStitchDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllVodStitchDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";

    ListVodStitchDetailsPagedResponse pagedListResponse = client.listVodStitchDetails(parent);

    List<VodStitchDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getVodStitchDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListVodStitchDetailsRequest actualRequest =
        ((ListVodStitchDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listVodStitchDetailsExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      client.listVodStitchDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodStitchDetailTest() throws Exception {
    VodStitchDetail expectedResponse =
        VodStitchDetail.newBuilder()
            .setName(
                VodStitchDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_STITCH_DETAIL]")
                    .toString())
            .addAllAdStitchDetails(new ArrayList<AdStitchDetail>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    VodStitchDetailName name =
        VodStitchDetailName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_STITCH_DETAIL]");

    VodStitchDetail actualResponse = client.getVodStitchDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodStitchDetailRequest actualRequest = ((GetVodStitchDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodStitchDetailExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      VodStitchDetailName name =
          VodStitchDetailName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_STITCH_DETAIL]");
      client.getVodStitchDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodStitchDetailTest2() throws Exception {
    VodStitchDetail expectedResponse =
        VodStitchDetail.newBuilder()
            .setName(
                VodStitchDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_STITCH_DETAIL]")
                    .toString())
            .addAllAdStitchDetails(new ArrayList<AdStitchDetail>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    VodStitchDetail actualResponse = client.getVodStitchDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodStitchDetailRequest actualRequest = ((GetVodStitchDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodStitchDetailExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getVodStitchDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listVodAdTagDetailsTest() throws Exception {
    VodAdTagDetail responsesElement = VodAdTagDetail.newBuilder().build();
    ListVodAdTagDetailsResponse expectedResponse =
        ListVodAdTagDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllVodAdTagDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    VodSessionName parent = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");

    ListVodAdTagDetailsPagedResponse pagedListResponse = client.listVodAdTagDetails(parent);

    List<VodAdTagDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getVodAdTagDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListVodAdTagDetailsRequest actualRequest = ((ListVodAdTagDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listVodAdTagDetailsExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      VodSessionName parent = VodSessionName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]");
      client.listVodAdTagDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listVodAdTagDetailsTest2() throws Exception {
    VodAdTagDetail responsesElement = VodAdTagDetail.newBuilder().build();
    ListVodAdTagDetailsResponse expectedResponse =
        ListVodAdTagDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllVodAdTagDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";

    ListVodAdTagDetailsPagedResponse pagedListResponse = client.listVodAdTagDetails(parent);

    List<VodAdTagDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getVodAdTagDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListVodAdTagDetailsRequest actualRequest = ((ListVodAdTagDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listVodAdTagDetailsExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      client.listVodAdTagDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodAdTagDetailTest() throws Exception {
    VodAdTagDetail expectedResponse =
        VodAdTagDetail.newBuilder()
            .setName(
                VodAdTagDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_AD_TAG_DETAIL]")
                    .toString())
            .addAllAdRequests(new ArrayList<AdRequest>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    VodAdTagDetailName name =
        VodAdTagDetailName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_AD_TAG_DETAIL]");

    VodAdTagDetail actualResponse = client.getVodAdTagDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodAdTagDetailRequest actualRequest = ((GetVodAdTagDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodAdTagDetailExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      VodAdTagDetailName name =
          VodAdTagDetailName.of("[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_AD_TAG_DETAIL]");
      client.getVodAdTagDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getVodAdTagDetailTest2() throws Exception {
    VodAdTagDetail expectedResponse =
        VodAdTagDetail.newBuilder()
            .setName(
                VodAdTagDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[VOD_SESSION]", "[VOD_AD_TAG_DETAIL]")
                    .toString())
            .addAllAdRequests(new ArrayList<AdRequest>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    VodAdTagDetail actualResponse = client.getVodAdTagDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetVodAdTagDetailRequest actualRequest = ((GetVodAdTagDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getVodAdTagDetailExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getVodAdTagDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listLiveAdTagDetailsTest() throws Exception {
    LiveAdTagDetail responsesElement = LiveAdTagDetail.newBuilder().build();
    ListLiveAdTagDetailsResponse expectedResponse =
        ListLiveAdTagDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllLiveAdTagDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LiveSessionName parent = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");

    ListLiveAdTagDetailsPagedResponse pagedListResponse = client.listLiveAdTagDetails(parent);

    List<LiveAdTagDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getLiveAdTagDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListLiveAdTagDetailsRequest actualRequest =
        ((ListLiveAdTagDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listLiveAdTagDetailsExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LiveSessionName parent = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");
      client.listLiveAdTagDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listLiveAdTagDetailsTest2() throws Exception {
    LiveAdTagDetail responsesElement = LiveAdTagDetail.newBuilder().build();
    ListLiveAdTagDetailsResponse expectedResponse =
        ListLiveAdTagDetailsResponse.newBuilder()
            .setNextPageToken("")
            .addAllLiveAdTagDetails(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";

    ListLiveAdTagDetailsPagedResponse pagedListResponse = client.listLiveAdTagDetails(parent);

    List<LiveAdTagDetail> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getLiveAdTagDetailsList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListLiveAdTagDetailsRequest actualRequest =
        ((ListLiveAdTagDetailsRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listLiveAdTagDetailsExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      client.listLiveAdTagDetails(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getLiveAdTagDetailTest() throws Exception {
    LiveAdTagDetail expectedResponse =
        LiveAdTagDetail.newBuilder()
            .setName(
                LiveAdTagDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[LIVE_SESSION]", "[LIVE_AD_TAG_DETAIL]")
                    .toString())
            .addAllAdRequests(new ArrayList<AdRequest>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LiveAdTagDetailName name =
        LiveAdTagDetailName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]", "[LIVE_AD_TAG_DETAIL]");

    LiveAdTagDetail actualResponse = client.getLiveAdTagDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetLiveAdTagDetailRequest actualRequest = ((GetLiveAdTagDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getLiveAdTagDetailExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LiveAdTagDetailName name =
          LiveAdTagDetailName.of(
              "[PROJECT]", "[LOCATION]", "[LIVE_SESSION]", "[LIVE_AD_TAG_DETAIL]");
      client.getLiveAdTagDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getLiveAdTagDetailTest2() throws Exception {
    LiveAdTagDetail expectedResponse =
        LiveAdTagDetail.newBuilder()
            .setName(
                LiveAdTagDetailName.of(
                        "[PROJECT]", "[LOCATION]", "[LIVE_SESSION]", "[LIVE_AD_TAG_DETAIL]")
                    .toString())
            .addAllAdRequests(new ArrayList<AdRequest>())
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    LiveAdTagDetail actualResponse = client.getLiveAdTagDetail(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetLiveAdTagDetailRequest actualRequest = ((GetLiveAdTagDetailRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getLiveAdTagDetailExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getLiveAdTagDetail(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createSlateTest() throws Exception {
    Slate expectedResponse =
        Slate.newBuilder()
            .setName(SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]").toString())
            .setUri("uri116076")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    Slate slate = Slate.newBuilder().build();
    String slateId = "slateId-2126174060";

    Slate actualResponse = client.createSlate(parent, slate, slateId);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateSlateRequest actualRequest = ((CreateSlateRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(slate, actualRequest.getSlate());
    Assert.assertEquals(slateId, actualRequest.getSlateId());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createSlateExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
      Slate slate = Slate.newBuilder().build();
      String slateId = "slateId-2126174060";
      client.createSlate(parent, slate, slateId);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createSlateTest2() throws Exception {
    Slate expectedResponse =
        Slate.newBuilder()
            .setName(SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]").toString())
            .setUri("uri116076")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";
    Slate slate = Slate.newBuilder().build();
    String slateId = "slateId-2126174060";

    Slate actualResponse = client.createSlate(parent, slate, slateId);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateSlateRequest actualRequest = ((CreateSlateRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(slate, actualRequest.getSlate());
    Assert.assertEquals(slateId, actualRequest.getSlateId());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createSlateExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      Slate slate = Slate.newBuilder().build();
      String slateId = "slateId-2126174060";
      client.createSlate(parent, slate, slateId);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listSlatesTest() throws Exception {
    Slate responsesElement = Slate.newBuilder().build();
    ListSlatesResponse expectedResponse =
        ListSlatesResponse.newBuilder()
            .setNextPageToken("")
            .addAllSlates(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");

    ListSlatesPagedResponse pagedListResponse = client.listSlates(parent);

    List<Slate> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSlatesList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSlatesRequest actualRequest = ((ListSlatesRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listSlatesExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
      client.listSlates(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void listSlatesTest2() throws Exception {
    Slate responsesElement = Slate.newBuilder().build();
    ListSlatesResponse expectedResponse =
        ListSlatesResponse.newBuilder()
            .setNextPageToken("")
            .addAllSlates(Arrays.asList(responsesElement))
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";

    ListSlatesPagedResponse pagedListResponse = client.listSlates(parent);

    List<Slate> resources = Lists.newArrayList(pagedListResponse.iterateAll());

    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSlatesList().get(0), resources.get(0));

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSlatesRequest actualRequest = ((ListSlatesRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void listSlatesExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      client.listSlates(parent);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getSlateTest() throws Exception {
    Slate expectedResponse =
        Slate.newBuilder()
            .setName(SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]").toString())
            .setUri("uri116076")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    SlateName name = SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]");

    Slate actualResponse = client.getSlate(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetSlateRequest actualRequest = ((GetSlateRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getSlateExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      SlateName name = SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]");
      client.getSlate(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getSlateTest2() throws Exception {
    Slate expectedResponse =
        Slate.newBuilder()
            .setName(SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]").toString())
            .setUri("uri116076")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    Slate actualResponse = client.getSlate(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetSlateRequest actualRequest = ((GetSlateRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getSlateExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getSlate(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void updateSlateTest() throws Exception {
    Slate expectedResponse =
        Slate.newBuilder()
            .setName(SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]").toString())
            .setUri("uri116076")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    Slate slate = Slate.newBuilder().build();
    FieldMask updateMask = FieldMask.newBuilder().build();

    Slate actualResponse = client.updateSlate(slate, updateMask);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateSlateRequest actualRequest = ((UpdateSlateRequest) actualRequests.get(0));

    Assert.assertEquals(slate, actualRequest.getSlate());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void updateSlateExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      Slate slate = Slate.newBuilder().build();
      FieldMask updateMask = FieldMask.newBuilder().build();
      client.updateSlate(slate, updateMask);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void deleteSlateTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockVideoStitcherService.addResponse(expectedResponse);

    SlateName name = SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]");

    client.deleteSlate(name);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteSlateRequest actualRequest = ((DeleteSlateRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void deleteSlateExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      SlateName name = SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]");
      client.deleteSlate(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void deleteSlateTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    client.deleteSlate(name);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteSlateRequest actualRequest = ((DeleteSlateRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void deleteSlateExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.deleteSlate(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createLiveSessionTest() throws Exception {
    LiveSession expectedResponse =
        LiveSession.newBuilder()
            .setName(LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]").toString())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setDefaultAdTagId("defaultAdTagId841142897")
            .putAllAdTagMap(new HashMap<String, AdTag>())
            .putAllAdTagMacros(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setDefaultSlateId("defaultSlateId-122056941")
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setStreamId("streamId1790933179")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LiveSessionName parent = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");
    LiveSession liveSession = LiveSession.newBuilder().build();

    LiveSession actualResponse = client.createLiveSession(parent, liveSession);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateLiveSessionRequest actualRequest = ((CreateLiveSessionRequest) actualRequests.get(0));

    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(liveSession, actualRequest.getLiveSession());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createLiveSessionExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LiveSessionName parent = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");
      LiveSession liveSession = LiveSession.newBuilder().build();
      client.createLiveSession(parent, liveSession);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void createLiveSessionTest2() throws Exception {
    LiveSession expectedResponse =
        LiveSession.newBuilder()
            .setName(LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]").toString())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setDefaultAdTagId("defaultAdTagId841142897")
            .putAllAdTagMap(new HashMap<String, AdTag>())
            .putAllAdTagMacros(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setDefaultSlateId("defaultSlateId-122056941")
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setStreamId("streamId1790933179")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String parent = "parent-995424086";
    LiveSession liveSession = LiveSession.newBuilder().build();

    LiveSession actualResponse = client.createLiveSession(parent, liveSession);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateLiveSessionRequest actualRequest = ((CreateLiveSessionRequest) actualRequests.get(0));

    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(liveSession, actualRequest.getLiveSession());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void createLiveSessionExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String parent = "parent-995424086";
      LiveSession liveSession = LiveSession.newBuilder().build();
      client.createLiveSession(parent, liveSession);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getLiveSessionTest() throws Exception {
    LiveSession expectedResponse =
        LiveSession.newBuilder()
            .setName(LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]").toString())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setDefaultAdTagId("defaultAdTagId841142897")
            .putAllAdTagMap(new HashMap<String, AdTag>())
            .putAllAdTagMacros(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setDefaultSlateId("defaultSlateId-122056941")
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setStreamId("streamId1790933179")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    LiveSessionName name = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");

    LiveSession actualResponse = client.getLiveSession(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetLiveSessionRequest actualRequest = ((GetLiveSessionRequest) actualRequests.get(0));

    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getLiveSessionExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      LiveSessionName name = LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]");
      client.getLiveSession(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }

  @Test
  public void getLiveSessionTest2() throws Exception {
    LiveSession expectedResponse =
        LiveSession.newBuilder()
            .setName(LiveSessionName.of("[PROJECT]", "[LOCATION]", "[LIVE_SESSION]").toString())
            .setPlayUri("playUri-493582952")
            .setSourceUri("sourceUri-1698419887")
            .setDefaultAdTagId("defaultAdTagId841142897")
            .putAllAdTagMap(new HashMap<String, AdTag>())
            .putAllAdTagMacros(new HashMap<String, String>())
            .setClientAdTracking(true)
            .setDefaultSlateId("defaultSlateId-122056941")
            .setManifestOptions(ManifestOptions.newBuilder().build())
            .setStreamId("streamId1790933179")
            .build();
    mockVideoStitcherService.addResponse(expectedResponse);

    String name = "name3373707";

    LiveSession actualResponse = client.getLiveSession(name);
    Assert.assertEquals(expectedResponse, actualResponse);

    List<AbstractMessage> actualRequests = mockVideoStitcherService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetLiveSessionRequest actualRequest = ((GetLiveSessionRequest) actualRequests.get(0));

    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(
        channelProvider.isHeaderSent(
            ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
            GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
  }

  @Test
  public void getLiveSessionExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockVideoStitcherService.addException(exception);

    try {
      String name = "name3373707";
      client.getLiveSession(name);
      Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
      // Expected exception.
    }
  }
}


text:
#ifndef __srtkMacro_h
#define __srtkMacro_h

#include <stdint.h>
#include <cassert>
#include <sstream>
#include <limits>

#include "srtkConfigure.h"

// Setup symbol exports
//
#if defined _WIN32 || defined __CYGWIN__
   #ifdef __GNUC__
    #define SRTK_ABI_EXPORT __attribute__ ((dllexport))
    #define SRTK_ABI_IMPORT __attribute__ ((dllimport))
    #define SRTK_ABI_HIDDEN
  #else
    #define SRTK_ABI_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
    #define SRTK_ABI_IMPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
    #define SRTK_ABI_HIDDEN
  #endif
#else
  #if __GNUC__ >= 4
    #define SRTK_ABI_EXPORT __attribute__ ((visibility ("default")))
    #define SRTK_ABI_IMPORT __attribute__ ((visibility ("default")))
    #define SRTK_ABI_HIDDEN  __attribute__ ((visibility ("hidden")))
  #else
    #define SRTK_ABI_EXPORT
    #define SRTK_ABI_IMPORT
    #define SRTK_ABI_HIDDEN
  #endif
#endif

namespace rtk {

namespace simple {

class GenericException;

#define srtkExceptionMacro(x)                                           \
  {                                                                     \
    std::ostringstream message;                                         \
    message << "srtk::ERROR: " x;                                       \
    throw ::rtk::simple::GenericException(__FILE__, __LINE__, message.str().c_str()); \
  }

#ifdef SRTK_HAS_CXX11_STATIC_ASSERT
// utilize the c++11 static_assert if available
#define srtkStaticAssert( expr, str) static_assert( expr, str )
#else

template<bool> struct StaticAssertFailure;
template<> struct StaticAssertFailure<true>{ enum { Value = 1 }; };

#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
#define BOOST_DO_JOIN2( X, Y ) X##Y

#define srtkStaticAssert( expr, str ) enum { BOOST_JOIN( static_assert_typedef, __LINE__) = sizeof( rtk::simple::StaticAssertFailure<((expr) == 0 ? false : true )> ) };

#endif

}
}

#endif

redpajama_set_name: RedPajamaGithub


text:
while [[ $# > 1 ]]
do
    key="$1"

    case $key in
        -ih|--ignitehome)
        IGNITE_HOME="$2"
        shift
        ;;
        -idb|--ignitedefbranch)
        IGNITE_DEFAULT_BRANCH="$2"
        shift
        ;;
        -ph|--patchhome)
        PATCHES_HOME="$2"
        shift
        ;;
        *)
                # unknown option
        ;;
    esac
    shift
done

#
# Init home and import properties and functions.
#
if [ -z ${IGNITE_HOME} ] # Script can be called from not IGNITE_HOME if IGNITE_HOME was set.
    then IGNITE_HOME=$PWD
fi

. ${IGNITE_HOME}/scripts/git-patch-prop.sh # Import properties.
. ${IGNITE_HOME}/scripts/git-patch-functions.sh # Import patch functions.

if [ -f ${IGNITE_HOME}/scripts/git-patch-prop-local.sh ] # Whether a local user properties file exists.
    then . ${IGNITE_HOME}/scripts/git-patch-prop-local.sh # Import user properties (it will rewrite global properties).
fi

IGNITE_CURRENT_BRANCH=$( determineCurrentBranch ${IGNITE_HOME} )

echo 'Usage: scripts/git-format-patch.sh [-ih|--ignitehome <path>] [-idb|--ignitedefbranch <branch-name>] [-ph|--patchhome <path>]'
echo "It should be called from IGNITE_HOME directory."
echo "Patch will be created at PATCHES_HOME between Master branch (IGNITE_DEFAULT_BRANCH) and Current branch."
echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh to set your own local properties (to rewrite settings at git-patch-prop-local.sh). "
echo
echo "IGNITE_HOME    : ${IGNITE_HOME}"
echo "Master branch  : ${IGNITE_DEFAULT_BRANCH}"
echo "Current branch : ${IGNITE_CURRENT_BRANCH}"
echo
echo "PATCHES_HOME   : ${PATCHES_HOME}"
echo

#
# Main script logic.
#

requireCleanWorkTree ${IGNITE_HOME}

formatPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_CURRENT_BRANCH} _ignite.patch


text:
/**
 * Property-esque values that can be listed in-game for the user to change.
 */
package com.github.obsidianarch.gvengine.core.options;


text:
package com.android.tools.build.bundletool.validation;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Sets.difference;
import static com.google.common.collect.Sets.newHashSet;

import com.android.aapt.Resources.ResourceTable;
import com.android.tools.build.bundletool.model.BundleModule;
import com.android.tools.build.bundletool.model.ModuleEntry;
import com.android.tools.build.bundletool.model.ResourceId;
import com.android.tools.build.bundletool.model.ZipPath;
import com.android.tools.build.bundletool.model.exceptions.InvalidBundleException;
import com.android.tools.build.bundletool.model.utils.ResourcesUtils;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.HashSet;

/**
 * Validates the resource table.
 *
 *
Validated properties:
 *
 *

 *
All files under the {@code res/} directory are referenced from the resource table.
 *
All files referenced from the resource table are located under the {@code res/} directory.
 *
All referenced files exist.
 *

 */
public class ResourceTableValidator extends SubValidator {

  @Override
  public void validateModule(BundleModule module) {
    // If module has no resource table, treat it as if the resource table were empty.
    ResourceTable resourceTable =
        module.getResourceTable().orElse(ResourceTable.getDefaultInstance());

    String moduleName = module.getName().getName();

    ImmutableSet<ZipPath> resFiles =
        module
            .findEntriesUnderPath(BundleModule.RESOURCES_DIRECTORY)
            .map(ModuleEntry::getPath)
            .collect(toImmutableSet());

    if (!resFiles.isEmpty() && !module.getResourceTable().isPresent()) {
      throw InvalidBundleException.builder()
          .withUserMessage(
              "Module '%s' contains resource files but is missing a resource table.", moduleName)
          .build();
    }

    ImmutableSet<ZipPath> referencedFiles = ResourcesUtils.getAllFileReferences(resourceTable);

    for (ZipPath referencedFile : referencedFiles) {
      if (!referencedFile.startsWith(BundleModule.RESOURCES_DIRECTORY)) {
        throw InvalidBundleException.builder()
            .withUserMessage(
                "Resource table of module '%s' references file '%s' outside of the '%s/'"
                    + " directory.",
                moduleName, referencedFile, BundleModule.RESOURCES_DIRECTORY)
            .build();
      }
    }

    ImmutableSet<ZipPath> nonReferencedFiles =
        ImmutableSet.copyOf(difference(resFiles, referencedFiles));
    if (!nonReferencedFiles.isEmpty()) {
      throw InvalidBundleException.builder()
          .withUserMessage(
              "Module '%s' contains resource files that are not referenced from the resource"
                  + " table: %s",
              moduleName, nonReferencedFiles)
          .build();
    }

    ImmutableSet<ZipPath> nonExistingFiles =
        ImmutableSet.copyOf(difference(referencedFiles, resFiles));
    if (!nonExistingFiles.isEmpty()) {
      throw InvalidBundleException.builder()
          .withUserMessage(
              "Resource table of module '%s' contains references to non-existing files: %s",
              moduleName, nonExistingFiles)
          .build();
    }
  }

  @Override
  public void validateAllModules(ImmutableList<BundleModule> modules) {
    if (!BundleValidationUtils.isAssetOnlyBundle(modules)) {
      checkResourceIds(modules);
    }
  }

  @VisibleForTesting
  void checkResourceIds(ImmutableList<BundleModule> modules) {
    BundleModule baseModule = BundleValidationUtils.expectBaseModule(modules);
    if (baseModule.getAndroidManifest().getIsolatedSplits().orElse(false)) {
      // If splits are isolated, resource IDs cannot be duplicated between modules included in
      // fusing. It's ok to have inter-module duplication for modules not included in fusing, but we
      // still need to check for uniqueness within each module.
      ImmutableList<BundleModule> modulesIncludedInFusing =
          modules.stream().filter(BundleModule::isIncludedInFusing).collect(toImmutableList());
      checkResourceIdsAreUnique(modulesIncludedInFusing);
      for (BundleModule module : modules) {
        if (!module.isIncludedInFusing()) {
          checkResourceIdsAreUnique(ImmutableList.of(module));
        }
      }
    } else {
      checkResourceIdsAreUnique(modules);
    }
  }

  private static void checkResourceIdsAreUnique(ImmutableList<BundleModule> modules) {
    HashSet<ResourceId> usedResourceIds = newHashSet();
    for (BundleModule module : modules) {
      ResourceTable resourceTable =
          module.getResourceTable().orElse(ResourceTable.getDefaultInstance());
      ResourcesUtils.entries(resourceTable)
          .forEach(
              resourceTableEntry -> {
                boolean foundDuplicate = !usedResourceIds.add(resourceTableEntry.getResourceId());
                if (foundDuplicate) {
                  throw InvalidBundleException.builder()
                      .withUserMessage(
                          "Duplicate resource id (%s).",
                          resourceTableEntry.getResourceId().toString())
                      .build();
                }
              });
    }
  }
}


text:
package com.fsck.k9.mail.store.imap;

import timber.log.Timber;

class ImapPushState {
    private static final long DEFAULT_UID_NEXT = -1L;
    private static final String PUSH_STATE_PREFIX = "uidNext=";
    private static final int PUSH_STATE_PREFIX_LENGTH = 8;

    public final long uidNext;

    public static ImapPushState parse(String pushState) {
        if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) {
            return createDefaultImapPushState();
        }

        String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH);
        try {
            long newUidNext = Long.parseLong(value);

            return new ImapPushState(newUidNext);
        } catch (NumberFormatException e) {
            Timber.e(e, "Unable to part uidNext value %s", value);
        }

        return createDefaultImapPushState();
    }

    static ImapPushState createDefaultImapPushState() {
        return new ImapPushState(DEFAULT_UID_NEXT);
    }

    public ImapPushState(long uidNext) {
        this.uidNext = uidNext;
    }

    @Override
    public String toString() {
        return "uidNext=" + uidNext;
    }
}


text:
const carlo = require('carlo')

/**
 * ref: https://github.com/GoogleChromeLabs/carlo#usage
 */

module.exports = async url => {
  // Launch the browser.
  const app = await carlo.launch()

  // Terminate Node.js process on app window closing.
  app.on('exit', () => process.exit())

  // Fetch from the next.js server
  app.serveOrigin(url)

  // Expose functions in the web environment.
  await app.exposeFunction('env', _ => process.env)
  await app.exposeFunction('getName', _ => 'next.js')

  // Navigate to the main page of your app.
  await app.load('/')
}


text:
#ifndef _acutilads_h
#define _acutilads_h 1

#include "adsdef.h"
#include "AdAChar.h"
#include "acdbport.h"

// These functions are exported with both extern "C" and C++ linkage. We may
// eventually drop support for C applications.

#pragma pack (push, 8)

void           acad__assert(const ACHAR *, const ACHAR *, int);

int            acutCvUnit (ads_real value, const ACHAR *oldunit,
                             const ACHAR *newunit, ads_real *result);
int            acutWcMatch (const ACHAR *string, const ACHAR *pattern);

int            acutPrintf (const ACHAR *format, ...);
int            acutSPrintf (ACHAR *buffer, size_t nBufLen, const ACHAR *format, ...);

struct resbuf *acutNewRb (int v);
int            acutRelRb (struct resbuf *rb);
struct resbuf *acutBuildList (int rtype, ...);

int            acutRbDup(const struct resbuf *source, struct resbuf **result);

ads_real       acutAngle (const ads_point pt1, const ads_point pt2);
ads_real       acutDistance (const ads_point pt1, const ads_point pt2);
void           acutPolar (const ads_point pt, ads_real angle,
                            ads_real dist, ads_point ptres);

int            acutIsAlpha (int c);
int            acutIsUpper (int c);
int            acutIsLower (int c);
int            acutIsDigit (int c);
int            acutIsXDigit (int c);
int            acutIsSpace (int c);
int            acutIsPunct (int c);
int            acutIsAlNum (int c);
int            acutIsPrint (int c);
int            acutIsGraph (int c);
int            acutIsCntrl (int c);
int            acutToUpper (int c);
int            acutToLower (int c);

#pragma pack (pop)

#ifdef __cplusplus

int acutVSPrintf(wchar_t *buf, size_t nBufLen, const wchar_t *fmt, va_list va);

template<size_t nBufLen> inline int acutSPrintf(wchar_t (& buf)[nBufLen], const ACHAR *format, ...)
{
    va_list va;
    va_start(va, format);
    const int nRet = ::acutVSPrintf(buf, nBufLen, format, va);
    va_end(va);
    return nRet;
}

template<size_t nBufLen> inline int acutVSPrintf(wchar_t (& buf)[nBufLen], const ACHAR *format,
                                                 va_list va)
{
    return ::acutVSPrintf(buf, nBufLen, format, va);
}

#endif

#endif // !acutilads.h


text:
package com.utn.dds.tpprevio;
import static org.junit.Assert.*;

import org.junit.Test;

import com.utn.dds.tpprevio.repository.CountryRepository;
import com.utn.dds.tpprevio.repository.StateRepository;
import com.utn.dds.tpprevio.repository.impl.CountryRepositoryImpl;
import com.utn.dds.tpprevio.repository.impl.StateRepositoryImpl;

public class StateRepositoryImplTest {
private StateRepository stateRepository = new StateRepositoryImpl();
private CountryRepository countryRepository = new CountryRepositoryImpl();
	@Test
	public void agregar_conStateValido_agregaCorrectamente() {
		countryRepository.agregar("ARGP","Argentina prueba");
		stateRepository.agregar("BS", "Buenos Aires","ARGP");
	  assertEquals("Buenos Aires",stateRepository.buscarPorId("BS").getName());
	}
}


text:
import pytest
import hubcheck
import time

pytestmark = []

class Timer(object):
    """A little timer class that we can use to time code in a with statement"""

    def __enter__(self):
        self.start = time.time()
        return self

    def __exit__(self,*args):
        self.end = time.time()
        self.elapsed = self.end - self.start

@pytest.mark.hub_timings
class TestHubTimings(hubcheck.testcase.TestCase2):

    def test_timed_login(self):
        """
        time logging into the hub website
        average login (and verification) through selenium is about 14 seconds
        if login takes longer than 30 seconds, we consider it a failure

        https://nanohub.org/support/ticket/265286
        https://nanohub.org/support/ticket/265257
        https://nanohub.org/support/ticket/265234
        https://nanohub.org/support/ticket/258652
        """

        self.username,self.userpass = \
            self.testdata.find_account_for('timinguser')

        # setup a web browser
        self.browser.get(self.https_authority)

        with Timer() as t:
            self.utils.account.login_as(self.username,self.userpass)

            # verify you have successfully logged in
            po = self.catalog.load_pageobject('GenericPage')
            assert po.header.is_logged_in(),'Login Failed'

        self.logger.info('elapsed time = %0.3f seconds' % (t.elapsed))
        assert t.elapsed < 30, \
            'logging into the website took %0.3f seconds' % t.elapsed


text:
#import "AdTypeTableViewController.h"
#import "BannerNativeVideoTrackerTestVC.h"
#import "InterstitialAdTrackerTestVC.h"
#import "Constant.h"
#import "MARBannerNativeRendererAdTrackerTestVC.h"
#import "BannerNativeVideoTrackerTestVC.h"
#import "ANHTTPStubbingManager.h"

@interface AdTypeTableViewController ()
@property (nonatomic, readwrite, strong) NSString *adType;

@end

@implementation AdTypeTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // Disable mocking based on MockTestcase is set to false(0)
    if(!MockTestcase){
        [[ANHTTPStubbingManager sharedStubbingManager] disable];
        [[ANHTTPStubbingManager sharedStubbingManager] removeAllStubs];
    }

    // Open BannerNativeVideoTrackerTestVC if arguments contain the BannerAd, BannerNativeAd, BannerVideoAd or BannerNativeRenderer Ad for Impression and Click Tracker
    if ([[NSProcessInfo processInfo].arguments containsObject:BannerImpressionClickTrackerTest] || [[NSProcessInfo processInfo].arguments containsObject:BannerNativeImpressionClickTrackerTest] || [[NSProcessInfo processInfo].arguments containsObject:BannerNativeRendererImpressionClickTrackerTest] || [[NSProcessInfo processInfo].arguments containsObject:BannerVideoImpressionClickTrackerTest] ) {
        [self openViewController:@"BannerNativeVideoTrackerTestVC"];
    }
    // Open InterstitialAdTrackerTestVC if arguments contain the Interstitial Ad for Impression and Click Tracker
    else if ([[NSProcessInfo processInfo].arguments containsObject:InterstitialImpressionClickTrackerTest]){
        [self openViewController:@"InterstitialAdTrackerTestVC"];
    }
    // Open VideoAdTrackerTestVC if arguments contain the Video Ad for Impression and Click Tracker
    else if([[NSProcessInfo processInfo].arguments containsObject:VideoImpressionClickTrackerTest] ){
        [self openViewController:@"VideoAdTrackerTestVC"];
    }
    // Open NativeAdTrackerTestVC if arguments contain the Native Ad for Impression and Click Tracker
    else if( [[NSProcessInfo processInfo].arguments containsObject:NativeImpressionClickTrackerTest] ){
        [self openViewController:@"NativeAdTrackerTestVC"];
    }
    // Open MARBannerNativeRendererAdTrackerTestVC if arguments contain the BannerNative Ad, BannerNativeRenderer Ad,Native Ad for Impression and Click Tracker
    else if( [[NSProcessInfo processInfo].arguments containsObject:MARBannerImpressionClickTrackerTest] ||  [[NSProcessInfo processInfo].arguments containsObject:MARNativeImpressionClickTrackerTest] ||[[NSProcessInfo processInfo].arguments containsObject:MARBannerNativeRendererImpressionClickTrackerTest]  ){
        [self openViewController:@"MARBannerNativeRendererAdTrackerTestVC"];
    }

    // Open BannerAdViewabilityTrackerTestVC if arguments contain the Banner Ad for Viewability Tracker [OMID]
    if( [[NSProcessInfo processInfo].arguments containsObject:BannerViewabilityTrackerTest]){
        [self openViewController:@"BannerAdViewabilityTrackerTestVC"];
    }
    // Open InterstitialAdViewabilityTrackerTestVC if arguments contain the InterstitialAd for Viewability Tracker [OMID]
    else if( [[NSProcessInfo processInfo].arguments containsObject:InterstitialViewabilityTrackerTest]){
        [self openViewController:@"InterstitialAdViewabilityTrackerTestVC"];
    }
    // Open BannerNativeAdViewabilityTrackerTestVC if arguments contain the BannerNative Ad, BannerNativeRenderer Ad,Native Ad for Viewability Tracker [OMID]
    else if( [[NSProcessInfo processInfo].arguments containsObject:NativeViewabilityTrackerTest] ||  [[NSProcessInfo processInfo].arguments containsObject:BannerNativeRendererViewabilityTrackerTest] || [[NSProcessInfo processInfo].arguments containsObject:BannerNativeViewabilityTrackerTest]  ){
        [self openViewController:@"BannerNativeAdViewabilityTrackerTestVC"];
    }

    else if( [[NSProcessInfo processInfo].arguments containsObject:NativeAdExpiry] ){
        [self openViewController:@"NativeAdExpiryTestVC"];
    }
    // Open BannerVideoAdViewabilityTrackerTestVC if arguments contain the BannerVideo Ad for Viewability Tracker [OMID]
    else if( [[NSProcessInfo processInfo].arguments containsObject:BannerVideoViewabilityTrackerTest]){
        [self openViewController:@"BannerVideoAdViewabilityTrackerTestVC"];
    }
    // Open VideoAdViewabilityTrackerTestVC if arguments contain the Video Ad for Viewability Tracker [OMID]
    else if( [[NSProcessInfo processInfo].arguments containsObject:VideoViewabilityTrackerTest]){
        [self openViewController:@"VideoAdViewabilityTrackerTestVC"];
    }else if( [[NSProcessInfo processInfo].arguments containsObject:BannerImpression1PxTrackerTest] || [[NSProcessInfo processInfo].arguments containsObject:NativeImpression1PxTrackerTest]){
        [self openViewController:@"ScrollViewController"];
    }
}

// navigation to desire viewController using storyboard Name & ViewController's Identifier
-(void)openViewController:(NSString *)viewController{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:viewController bundle:nil];
    UIViewController *vc = [sb instantiateViewControllerWithIdentifier:viewController];
    [vc setModalPresentationStyle: UIModalPresentationFullScreen];
    [self.navigationController pushViewController:vc animated:YES];

}

@end