Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Add missing test to ReplaceIfExceptionMatchingProxy. (#4650)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkozlowski authored Mar 13, 2020
1 parent 574582c commit 3b8afcd
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.palantir.common.proxy;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -57,4 +58,14 @@ public void testExceptionMatching() {
assertThatThrownBy(iface::doSomething).isEqualTo(exception);
verify(supplier, times(2)).get();
}

@Test
public void testEqualsHashCodeToStringNotDelegated() {
TestInterface iface = ReplaceIfExceptionMatchingProxy.newProxyInstance(
TestInterface.class, supplier, _thrown -> true);
assertThat(iface.toString()).isNotEqualTo(delegate.toString());
assertThat(iface).isEqualTo(iface);
assertThat(iface).isNotEqualTo(delegate);
assertThat(iface.hashCode()).isNotEqualTo(delegate.hashCode());
}
}

0 comments on commit 3b8afcd

Please sign in to comment.