Skip to content

Commit

Permalink
Don't use deprecated methods of Mockito
Browse files Browse the repository at this point in the history
[skip release]
  • Loading branch information
slawekjaranowski committed Jan 3, 2022
1 parent e34ac16 commit c0fd431
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import java.util.Observable;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

Expand All @@ -31,7 +31,7 @@ public class MockFieldsShouldBeResetBetweenTestMethodsTest {
@Mock Observable will_be_nulled;

@Test
public void behaviour_A_without_infection_from_behaviour_B() throws Exception {
public void behaviour_A_without_infection_from_behaviour_B() {
// verify mock is clean
assertThat(list.get(0)).isNull();
verify(list, never()).add(anyString());
Expand All @@ -44,7 +44,7 @@ public void behaviour_A_without_infection_from_behaviour_B() throws Exception {
}

@Test
public void behaviour_B_without_infection_from_behaviour_A() throws Exception {
public void behaviour_B_without_infection_from_behaviour_A() {
// verify mock is clean
assertThat(list.get(0)).isNull();
verify(list, never()).add(anyString());
Expand All @@ -57,7 +57,7 @@ public void behaviour_B_without_infection_from_behaviour_A() throws Exception {
}

@Test
public void dont_fail_when_reseting_null_field() throws Exception {
public void dont_fail_when_reseting_null_field() {
will_be_nulled = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

import static org.mockito.ArgumentMatchers.anySet;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;

import java.io.PrintStream;

import org.mockito.testng.MockitoTestNGListener;
import org.testng.annotations.Listeners;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package org.mockitousage.testng.failuretests;

import static org.mockito.ArgumentMatchers.anyString;

import org.mockito.Mock;
import org.mockito.testng.MockitoTestNGListener;
import org.testng.annotations.BeforeMethod;
Expand All @@ -12,8 +14,6 @@

import java.util.List;

import static org.mockito.Matchers.anyString;

/**
* Should fail.
*
Expand All @@ -32,7 +32,7 @@ public class FailingOnPurposeBecauseWrongStubbingSyntaxInConfigurationMethod {


@Test
public void here_to_execute_the_config_method() throws Exception {
public void here_to_execute_the_config_method() {
}

}

0 comments on commit c0fd431

Please sign in to comment.