-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWC-7040 - Bump Java version to 11 #5500
Conversation
Also bump Guice to 6, Mockito to 2, and lock guice-assistedinject to 6 to override Gin. Migrate many tests to be compatible with Mockito 2. The main reason tests had to change was because `anyString()` and `any(Foo.class)` matchers do not allow `null` as a valid match in v2, but they do in v1. In these cases, just use `any()`
"dev:codeserver": "mvn gwt:run-codeserver -Dgwt.compiler.skip=true -Dnoserver=true -Dwar=/$(pwd)/target/portal-develop-SNAPSHOT -Dstyle=PRETTY", | ||
"dev": "concurrently -k -n \"CODESERVER,TOMCAT\" -c \"auto,auto\" \"yarn dev:codeserver\" \"yarn dev:tomcat\"", | ||
"dev:codeserver": "mvn clean gwt:run-codeserver", | ||
"dev:tomcat": "wait-on tcp:9876 && docker pull tomcat:9.0; docker run --name swc-dev --rm -p 8888:8080 -v \"/$(pwd)/target/portal-develop-SNAPSHOT/:/usr/local/tomcat/webapps/ROOT/\" -v \"/$HOME/.m2/settings.xml\":/root/.m2/settings.xml tomcat:9.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait-on
will prevent Tomcat from launching until the code server is ready
@@ -138,7 +138,7 @@ | |||
import org.sagebionetworks.web.shared.exceptions.UnauthorizedException; | |||
import org.sagebionetworks.web.shared.exceptions.UnknownErrorException; | |||
|
|||
@RunWith(MockitoJUnitRunner.class) | |||
@RunWith(MockitoJUnitRunner.Silent.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without Silent
, mockito fails tests that have mocks that are not called. Which is great, but a ton of unnecessary work to fix.
when( | ||
mockRequestBuilder.sendRequest(anyString(), any(RequestCallback.class)) | ||
) | ||
when(mockRequestBuilder.sendRequest(any(), any(RequestCallback.class))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For nearly all of these test changes, the mock was called where the matcher received null
. In Mockito v1, anyString()
matched null. In Mockito v2, it does not. Replace it with any()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I understand why my newly checked in test with anyLong() may fail :)
Also bump Guice to 6, Mockito to 2, and lock guice-assistedinject to 6 to override Gin.
Migrate many tests to be compatible with Mockito 2. The main reason tests had to change was because
anyString()
andany(Foo.class)
matchers do not allownull
as a valid match in v2, but they do in v1. In these cases, just useany()
Also fix the dev scripts so now
yarn dev
should launch the GWT Codeserver and a Tomcat 9 container that will re-compile on refresh if there's a source code change.We should be able to upgrade to Java 17 at a later date just by upgrading the JDK and compile target.