Skip to content

Commit

Permalink
Upgrade to Mockito 4.11.0 with some small required code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rfscholte committed Sep 23, 2023
1 parent 0dcb9f3 commit d6ce8ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.5</version>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import java.net.URL;
import java.util.*;

import static org.mockito.Matchers.any;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.*;

public class JavaProjectBuilderTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Collections;
import java.util.List;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/thoughtworks/qdox/parser/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.stubbing.answers.ReturnsElementsOf;

import java.util.Collection;
import java.util.LinkedList;

import static org.mockito.Mockito.*;
import static org.mockito.AdditionalAnswers.returnsElementsOf;

public class ParserTest {

Expand Down Expand Up @@ -3137,9 +3137,9 @@ private void setupLex( int token ) throws Exception
setupLex( token, null );
if ( token == 0 )
{
when( lexer.lex() ).thenAnswer( new ReturnsElementsOf( lexValues ) );
when( lexer.text() ).thenAnswer( new ReturnsElementsOf( textValues ) );
when( lexer.getCodeBody() ).thenAnswer( new ReturnsElementsOf( codeBodyValues ) );
when( lexer.lex() ).thenAnswer( returnsElementsOf( lexValues ) );
when( lexer.text() ).thenAnswer( returnsElementsOf( textValues ) );
when( lexer.getCodeBody() ).thenAnswer( returnsElementsOf( codeBodyValues ) );
when( lexer.getLine() ).thenReturn( -1 );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.stubbing.answers.ReturnsElementsOf;

import java.io.IOException;
import java.util.Collection;
import java.util.LinkedList;

import static org.mockito.Mockito.*;
import static org.mockito.AdditionalAnswers.returnsElementsOf;

public class DefaultJavaCommentParserTest
{
Expand Down Expand Up @@ -208,8 +208,8 @@ private void setupLex(int token) throws IOException {
setupLex(token, null);
if( token == 0)
{
when( lexer.lex() ).thenAnswer( new ReturnsElementsOf( lexValues ) );
when( lexer.text() ).thenAnswer( new ReturnsElementsOf( textValues ) );
when( lexer.lex() ).thenAnswer( returnsElementsOf( lexValues ) );
when( lexer.text() ).thenAnswer( returnsElementsOf( textValues ) );
when( lexer.getLine() ).thenReturn( -1 );
}
}
Expand Down

0 comments on commit d6ce8ca

Please sign in to comment.