Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toString method to AbstractInstrument #4883

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,4 +39,9 @@ public boolean equals(@Nullable Object o) {
public int hashCode() {
return descriptor.hashCode();
}

@Override
public String toString() {
return this.getClass().getSimpleName() + "{" + "descriptor=" + getDescriptor() + '}';
}
}
Expand Up @@ -22,6 +22,13 @@ void getValues() {
assertThat(testInstrument.getDescriptor()).isSameAs(INSTRUMENT_DESCRIPTOR);
}

@Test
void testToString() {
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
assertThat(testInstrument)
.hasToString("TestInstrument{descriptor=" + INSTRUMENT_DESCRIPTOR + "}");
}

private static final class TestInstrument extends AbstractInstrument {
TestInstrument(InstrumentDescriptor descriptor) {
super(descriptor);
Expand Down