Skip to content

Commit

Permalink
Get rid of mockito
Browse files Browse the repository at this point in the history
  • Loading branch information
l3r8yJ committed Aug 2, 2023
1 parent 10fb133 commit 0a3b421
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ SOFTWARE.
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-matchers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ public Collection<Complaint> complaints() {
* @return True if contains line hitter
*/
private Boolean containsLineHitter() {
boolean result = false;
if (!this.test.assertions().isEmpty()) {
result = this.test.assertions()
.stream()
.anyMatch(Assertion::isLineHitter);
}
return result;
return this.test.assertions()
.stream()
.anyMatch(Assertion::isLineHitter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* Test case for {@link RuleAssertTrueHitter}.
Expand All @@ -54,12 +53,15 @@ void checksClassWithoutHitterCorrectly() {
@SuppressWarnings("PMD.JUnitTestContainsTooManyAsserts")
@Test
void checksClassWithHitterCorrectly() {
final Assertion assertion = Mockito.mock(Assertion.class);
Mockito.when(assertion.isLineHitter()).thenReturn(true);
MatcherAssert.assertThat(
"Test class with line hitter should have complaints",
new RuleAssertTrueHitter(
new TestCase.Fake(assertion)
new TestCase.Fake(
new Assertion.Fake(
"msg",
true
)
)
).complaints(),
Matchers.hasSize(1)
);
Expand Down

0 comments on commit 0a3b421

Please sign in to comment.