Make fields final
Closes gh-33537
This commit is contained in:
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*/
|
||||
class ClassPathChangedEventTests {
|
||||
|
||||
private Object source = new Object();
|
||||
private final Object source = new Object();
|
||||
|
||||
@Test
|
||||
void changeSetMustNotBeNull() {
|
||||
|
||||
@@ -117,7 +117,7 @@ class ClassPathFileSystemWatcherTests {
|
||||
|
||||
static class Listener implements ApplicationListener<ClassPathChangedEvent> {
|
||||
|
||||
private List<ClassPathChangedEvent> events = new CopyOnWriteArrayList<>();
|
||||
private final List<ClassPathChangedEvent> events = new CopyOnWriteArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ClassPathChangedEvent event) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class FileSystemWatcherTests {
|
||||
|
||||
private FileSystemWatcher watcher;
|
||||
|
||||
private List<Set<ChangedFiles>> changes = Collections.synchronizedList(new ArrayList<>());
|
||||
private final List<Set<ChangedFiles>> changes = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
@@ -54,11 +54,11 @@ class DispatcherTests {
|
||||
@Mock
|
||||
private AccessManager accessManager;
|
||||
|
||||
private MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
private final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
private ServerHttpRequest serverRequest = new ServletServerHttpRequest(new MockHttpServletRequest());
|
||||
private final ServerHttpRequest serverRequest = new ServletServerHttpRequest(new MockHttpServletRequest());
|
||||
|
||||
private ServerHttpResponse serverResponse = new ServletServerHttpResponse(this.response);
|
||||
private final ServerHttpResponse serverResponse = new ServletServerHttpResponse(this.response);
|
||||
|
||||
@Test
|
||||
void accessManagerMustNotBeNull() {
|
||||
|
||||
@@ -35,7 +35,7 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
class UrlHandlerMapperTests {
|
||||
|
||||
private Handler handler = mock(Handler.class);
|
||||
private final Handler handler = mock(Handler.class);
|
||||
|
||||
@Test
|
||||
void requestUriMustNotBeNull() {
|
||||
|
||||
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
*/
|
||||
class MainMethodTests {
|
||||
|
||||
private static ThreadLocal<MainMethod> mainMethod = new ThreadLocal<>();
|
||||
private static final ThreadLocal<MainMethod> mainMethod = new ThreadLocal<>();
|
||||
|
||||
private Method actualMain;
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class MockRestarter implements BeforeEachCallback, AfterEachCallback, ParameterResolver {
|
||||
|
||||
private Map<String, Object> attributes = new HashMap<>();
|
||||
private final Map<String, Object> attributes = new HashMap<>();
|
||||
|
||||
private Restarter mock = mock(Restarter.class);
|
||||
private final Restarter mock = mock(Restarter.class);
|
||||
|
||||
public Restarter getMock() {
|
||||
return this.mock;
|
||||
|
||||
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
class ClassLoaderFilesTests {
|
||||
|
||||
private ClassLoaderFiles files = new ClassLoaderFiles();
|
||||
private final ClassLoaderFiles files = new ClassLoaderFiles();
|
||||
|
||||
@Test
|
||||
void addFileNameMustNotBeNull() {
|
||||
|
||||
@@ -52,7 +52,7 @@ class DefaultSourceDirectoryUrlFilterTests {
|
||||
COMMON_POSTFIXES = Collections.unmodifiableList(postfixes);
|
||||
}
|
||||
|
||||
private DefaultSourceDirectoryUrlFilter filter = new DefaultSourceDirectoryUrlFilter();
|
||||
private final DefaultSourceDirectoryUrlFilter filter = new DefaultSourceDirectoryUrlFilter();
|
||||
|
||||
@Test
|
||||
void mavenSourceDirectory() throws Exception {
|
||||
|
||||
@@ -43,11 +43,11 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory {
|
||||
|
||||
private static final byte[] NO_DATA = {};
|
||||
|
||||
private AtomicLong seq = new AtomicLong();
|
||||
private final AtomicLong seq = new AtomicLong();
|
||||
|
||||
private Deque<Object> responses = new ArrayDeque<>();
|
||||
private final Deque<Object> responses = new ArrayDeque<>();
|
||||
|
||||
private List<MockClientHttpRequest> executedRequests = new ArrayList<>();
|
||||
private final List<MockClientHttpRequest> executedRequests = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
|
||||
|
||||
@@ -61,7 +61,7 @@ class HttpTunnelConnectionTests {
|
||||
@Mock
|
||||
private Closeable closeable;
|
||||
|
||||
private MockClientHttpRequestFactory requestFactory = new MockClientHttpRequestFactory();
|
||||
private final MockClientHttpRequestFactory requestFactory = new MockClientHttpRequestFactory();
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
|
||||
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*/
|
||||
class TunnelClientTests {
|
||||
|
||||
private MockTunnelConnection tunnelConnection = new MockTunnelConnection();
|
||||
private final MockTunnelConnection tunnelConnection = new MockTunnelConnection();
|
||||
|
||||
@Test
|
||||
void listenPortMustNotBeNegative() {
|
||||
|
||||
@@ -346,11 +346,11 @@ class HttpTunnelServerTests {
|
||||
|
||||
private int timeout;
|
||||
|
||||
private BlockingDeque<ByteBuffer> outgoing = new LinkedBlockingDeque<>();
|
||||
private final BlockingDeque<ByteBuffer> outgoing = new LinkedBlockingDeque<>();
|
||||
|
||||
private ByteArrayOutputStream written = new ByteArrayOutputStream();
|
||||
private final ByteArrayOutputStream written = new ByteArrayOutputStream();
|
||||
|
||||
private AtomicBoolean open = new AtomicBoolean(true);
|
||||
private final AtomicBoolean open = new AtomicBoolean(true);
|
||||
|
||||
void setTimeout(int timeout) {
|
||||
this.timeout = timeout;
|
||||
|
||||
@@ -85,7 +85,7 @@ class SocketTargetServerConnectionTests {
|
||||
|
||||
static class MockServer {
|
||||
|
||||
private ServerSocketChannel serverSocket;
|
||||
private final ServerSocketChannel serverSocket;
|
||||
|
||||
private byte[] send;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user