@Override
    public boolean equals(Object other) {
        return other instanceof SourceAndTarget && toString().equals(other.toString());
    }
@Test
    public void testEquals() {
        SourceAndTarget sourceAndTarget = new SourceAndTarget("source", "target");
        SourceAndTarget sourceAndTarget2 = new SourceAndTarget("source", "target");
        SourceAndTarget sourceAndTarget3 = new SourceAndTarget("error-source", "target");
        assertEquals(sourceAndTarget, sourceAndTarget2);
        assertNotEquals(sourceAndTarget, sourceAndTarget3);

        class FakeSourceAndTarget {
            private final String source;
            private final String target;

            public FakeSourceAndTarget(String source, String target) {
                this.source = source;
                this.target = target;
            }

            @Override
            public String toString() {
                return source + "->" + target;
            }
        }
        FakeSourceAndTarget fakeSourceAndTarget = new FakeSourceAndTarget("source", "target");
        assertNotEquals(sourceAndTarget, fakeSourceAndTarget);
    }