KafkaStreamsBinderMetrics throws ClassCastException

Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/814

Fixing an erroneous cast.
This commit is contained in:
Soby Chacko
2020-02-11 16:10:06 -05:00
parent f397f7c313
commit 1b6f9f5806
2 changed files with 2 additions and 1 deletions

View File

@@ -89,7 +89,7 @@ public class KafkaStreamsBinderMetrics {
ToDoubleFunction toDoubleFunction(Metric metric) {
return (o) -> {
if (metric.metricValue() instanceof Number) {
return (Double) metric.metricValue();
return ((Number) metric.metricValue()).doubleValue();
}
else {
return 0.0;

View File

@@ -106,6 +106,7 @@ public class KafkaStreamsBinderWordCountFunctionTests {
final MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);
Thread.sleep(100);
assertThat(meterRegistry.get("stream.metrics.commit.total").gauge().value()).isEqualTo(1.0);
assertThat(meterRegistry.get("app.info.start.time.ms").gauge().value()).isNotNaN();
Assert.isTrue(LATCH.await(5, TimeUnit.SECONDS), "Failed to call customizers");
}
}