Skip to content

Commit

Permalink
Fixes or removes tests that build on unfulfilled assumptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Aug 24, 2021
1 parent c740965 commit e1f9855
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void ensure_cache_returns_different_instance_serializableMode() throws Ex
}

@Test
public void ensure_cache_returns_different_instance_defaultAnswer() throws Exception {
public void ensure_cache_returns_same_instance_defaultAnswer() throws Exception {
// given
ClassLoader classloader_with_life_shorter_than_cache =
inMemoryClassLoader()
Expand Down Expand Up @@ -174,10 +174,10 @@ public void ensure_cache_returns_different_instance_defaultAnswer() throws Excep
SerializableMode.NONE,
false,
answer));
assertThat(classes.add(klass)).isTrue();
assertThat(classes.add(klass)).isFalse();
}

assertThat(classes).hasSize(answers.length + 1);
assertThat(classes).hasSize(1);
}

@Test
Expand Down

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/test/java/org/mockitousage/spies/SpyingOnRealObjectsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static org.junit.Assume.assumeTrue;
import static org.mockito.Mockito.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -193,13 +192,4 @@ public void shouldSayNiceMessageWhenSpyingOnPrivateClass() throws Exception {
"Most likely it is due to mocking a private class that is not visible to Mockito");
}
}

@Test
public void spysHashCodeEqualsDelegatedToActualMethods() {
List<String> real = new ArrayList<>();
real.add("one");
List<String> spy = spy(real);
assertEquals(real.hashCode(), spy.hashCode());
assertTrue(spy.equals(real));
}

This comment has been minimized.

Copy link
@cdalexndr

cdalexndr Mar 5, 2022

this test woked before 1a8946f

}

0 comments on commit e1f9855

Please sign in to comment.