### Question:
OtlpGrpcMetricExporter implements MetricExporter { @Override public CompletableResultCode export(Collection<MetricData> metrics) { ExportMetricsServiceRequest exportMetricsServiceRequest = ExportMetricsServiceRequest.newBuilder() .addAllResourceMetrics(MetricAdapter.toProtoResourceMetrics(metrics)) .build(); final CompletableResultCode result = new CompletableResultCode(); MetricsServiceFutureStub exporter; if (deadlineMs > 0) { exporter = metricsService.withDeadlineAfter(deadlineMs, TimeUnit.MILLISECONDS); } else { exporter = metricsService; } Futures.addCallback( exporter.export(exportMetricsServiceRequest), new FutureCallback<ExportMetricsServiceResponse>() { @Override public void onSuccess(@Nullable ExportMetricsServiceResponse response) { result.succeed(); } @Override public void onFailure(Throwable t) { logger.log(Level.WARNING, "Failed to export metrics", t); result.fail(); } }, MoreExecutors.directExecutor()); return result; } private  OtlpGrpcMetricExporter(ManagedChannel channel, long deadlineMs); @Override CompletableResultCode export(Collection<MetricData> metrics); @Override CompletableResultCode flush(); static Builder newBuilder(); static OtlpGrpcMetricExporter getDefault(); @Override void shutdown(); static final String DEFAULT_ENDPOINT; static final long DEFAULT_DEADLINE_MS; }### Answer:
@Test void testExport() { MetricData span = generateFakeMetric(); OtlpGrpcMetricExporter exporter = OtlpGrpcMetricExporter.newBuilder().setChannel(inProcessChannel).build(); try { assertThat(exporter.export(Collections.singletonList(span)).isSuccess()).isTrue(); assertThat(fakeCollector.getReceivedMetrics()) .isEqualTo(MetricAdapter.toProtoResourceMetrics(Collections.singletonList(span))); } finally { exporter.shutdown(); } }