@Test
public void testBindServiceContainsAllMethods() throws Exception {

  IDevice mockDevice = mock(IDevice.class);
  when(mockDevice.getSerialNumber()).thenReturn("Serial");
  when(mockDevice.getName()).thenReturn("Device");
  when(mockDevice.getVersion()).thenReturn(new AndroidVersion(1, "API"));
  when(mockDevice.isOnline()).thenReturn(true);
  when(mockDevice.getClients()).thenReturn(new Client[0]);
  ManagedChannel channel = InProcessChannelBuilder.forName("CpuServiceProxyTest").build();
  CpuServiceProxy proxy = new CpuServiceProxy(mockDevice, channel, new FakeLegacyCpuTraceProfiler());
  ServerServiceDefinition serverDefinition = proxy.getServiceDefinition();
  Collection<MethodDescriptor<?, ?>> allMethods = CpuServiceGrpc.getServiceDescriptor().getMethods();
  Set<MethodDescriptor<?, ?>> definedMethods =
    serverDefinition.getMethods().stream().map(method -> method.getMethodDescriptor()).collect(Collectors.toSet());
  assertThat(definedMethods.size()).isEqualTo(allMethods.size());
  definedMethods.containsAll(allMethods);
}