mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
Clean up generics
This commit is contained in:
@@ -12,19 +12,20 @@ public class CloseableWrapperTest {
|
||||
|
||||
@Test
|
||||
public void shouldExecuteGivenMethodAtClose() {
|
||||
Consumer<String> wrapped = new Consumer<String>() {
|
||||
Consumer<AutoCloseable> wrapped = new Consumer<AutoCloseable>() {
|
||||
// no this cannot be replaced with a lambda because otherwise we could not use Mockito#spy
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
public void accept(AutoCloseable s) {
|
||||
}
|
||||
};
|
||||
|
||||
Consumer<String> closer = spy(wrapped);
|
||||
Consumer<AutoCloseable> closer = spy(wrapped);
|
||||
|
||||
try (CloseableWrapper<String> wrapper = new CloseableWrapper<>("test", closer)) {
|
||||
AutoCloseable autoCloseable = () -> {};
|
||||
try (CloseableWrapper<AutoCloseable> wrapper = new CloseableWrapper<>(autoCloseable, closer)) {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
verify(closer).accept("test");
|
||||
verify(closer).accept(autoCloseable);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user