@Override
public String toString() {
- return descriptor.name() + (LOG.isDebugEnabled() ? " (wrapped)" : "");
+ if (descriptor.name() != null) {
+ return descriptor.name();
+ } else {
+ return wrappedSensor.getClass().getName();
+ }
}
}
assertThat(BatchUtils.encodeForUrl("foo&bar")).isEqualTo("foo%26bar");
}
+ private class MyClass {
+ @Override
+ public String toString() {
+ return null;
+ }
+ }
@Test
-
public void testDescribe() {
Object withToString = new Object() {
@Override
assertThat(BatchUtils.describe(withToString)).isEqualTo(("desc"));
assertThat(BatchUtils.describe(withoutToString)).isEqualTo("java.lang.Object");
+ assertThat(BatchUtils.describe(new MyClass())).endsWith("MyClass");
}
}