### Question:
MetricAdapter { @SuppressWarnings("fallthrough") static Metric toProtoMetric(MetricData metricData) { Metric.Builder builder = Metric.newBuilder() .setName(metricData.getName()) .setDescription(metricData.getDescription()) .setUnit(metricData.getUnit()); if (metricData.getPoints().isEmpty()) { return builder.build(); } boolean monotonic = false; switch (metricData.getType()) { case MONOTONIC_LONG: monotonic = true; case NON_MONOTONIC_LONG: builder.setIntSum( IntSum.newBuilder() .setIsMonotonic(monotonic) .setAggregationTemporality(mapToTemporality(metricData.getType())) .addAllDataPoints(toIntDataPoints(metricData.getPoints())) .build()); break; case MONOTONIC_DOUBLE: monotonic = true; case NON_MONOTONIC_DOUBLE: builder.setDoubleSum( DoubleSum.newBuilder() .setIsMonotonic(monotonic) .setAggregationTemporality(mapToTemporality(metricData.getType())) .addAllDataPoints(toDoubleDataPoints(metricData.getPoints())) .build()); break; case SUMMARY: builder.setDoubleHistogram( DoubleHistogram.newBuilder() .setAggregationTemporality(mapToTemporality(metricData.getType())) .addAllDataPoints(toSummaryDataPoints(metricData.getPoints())) .build()); break; } return builder.build(); } private  MetricAdapter();   }### Answer:
@Test void toProtoMetric() { assertThat( MetricAdapter.toProtoMetric( MetricData.create( Resource.getEmpty(), InstrumentationLibraryInfo.getEmpty(), "name", "description", "1", MetricData.Type.MONOTONIC_LONG, singletonList(MetricData.LongPoint.create(123, 456, Labels.of("k", "v"), 5))))) .isEqualTo( Metric.newBuilder() .setName("name") .setDescription("description") .setUnit("1") .setIntSum( IntSum.newBuilder() .setIsMonotonic(true) .setAggregationTemporality(AGGREGATION_TEMPORALITY_CUMULATIVE) .addDataPoints( IntDataPoint.newBuilder() .setStartTimeUnixNano(123) .setTimeUnixNano(456) .addAllLabels( singletonList( StringKeyValue.newBuilder() .setKey("k") .setValue("v") .build())) .setValue(5) .build()) .build()) .build()); assertThat( MetricAdapter.toProtoMetric( MetricData.create( Resource.getEmpty(), InstrumentationLibraryInfo.getEmpty(), "name", "description", "1", MetricData.Type.MONOTONIC_DOUBLE, singletonList( MetricData.DoublePoint.create(123, 456, Labels.of("k", "v"), 5.1))))) .isEqualTo( Metric.newBuilder() .setName("name") .setDescription("description") .setUnit("1") .setDoubleSum( DoubleSum.newBuilder() .setIsMonotonic(true) .setAggregationTemporality(AGGREGATION_TEMPORALITY_CUMULATIVE) .addDataPoints( DoubleDataPoint.newBuilder() .setStartTimeUnixNano(123) .setTimeUnixNano(456) .addAllLabels( singletonList( StringKeyValue.newBuilder() .setKey("k") .setValue("v") .build())) .setValue(5.1) .build()) .build()) .build()); }