Make fields private where possible
This commit is contained in:
@@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class InMemoryAuditEventRepositoryTests {
|
||||
|
||||
private InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository();
|
||||
private final InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository();
|
||||
|
||||
@Test
|
||||
public void testAddToCapacity() throws Exception {
|
||||
|
||||
@@ -56,7 +56,7 @@ import static org.junit.Assert.assertThat;
|
||||
*/
|
||||
public class EndpointWebMvcAutoConfigurationTests {
|
||||
|
||||
private AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
private final AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
|
||||
@After
|
||||
public void close() {
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.junit.Assert.assertThat;
|
||||
*/
|
||||
public class EndpointHandlerMappingTests {
|
||||
|
||||
private StaticApplicationContext context = new StaticApplicationContext();
|
||||
private final StaticApplicationContext context = new StaticApplicationContext();
|
||||
private Method method;
|
||||
|
||||
@Before
|
||||
|
||||
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.when;
|
||||
*/
|
||||
public class SimpleHealthIndicatorTests {
|
||||
|
||||
private SimpleHealthIndicator indicator = new SimpleHealthIndicator();
|
||||
private final SimpleHealthIndicator indicator = new SimpleHealthIndicator();
|
||||
private DriverManagerDataSource dataSource;
|
||||
|
||||
@Before
|
||||
|
||||
@@ -29,9 +29,9 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class MetricCopyExporterTests {
|
||||
|
||||
private InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
private InMemoryMetricRepository reader = new InMemoryMetricRepository();
|
||||
private MetricCopyExporter exporter = new MetricCopyExporter(this.reader, this.writer);
|
||||
private final InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
private final InMemoryMetricRepository reader = new InMemoryMetricRepository();
|
||||
private final MetricCopyExporter exporter = new MetricCopyExporter(this.reader, this.writer);
|
||||
|
||||
@Test
|
||||
public void export() {
|
||||
|
||||
@@ -32,11 +32,11 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class PrefixMetricGroupExporterTests {
|
||||
|
||||
private InMemoryMetricRepository reader = new InMemoryMetricRepository();
|
||||
private final InMemoryMetricRepository reader = new InMemoryMetricRepository();
|
||||
|
||||
private InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
private final InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
|
||||
private PrefixMetricGroupExporter exporter = new PrefixMetricGroupExporter(
|
||||
private final PrefixMetricGroupExporter exporter = new PrefixMetricGroupExporter(
|
||||
this.reader, this.writer);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -29,9 +29,9 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class RichGaugeExporterTests {
|
||||
|
||||
private InMemoryRichGaugeRepository reader = new InMemoryRichGaugeRepository();
|
||||
private InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
private RichGaugeExporter exporter = new RichGaugeExporter(this.reader, this.writer);
|
||||
private final InMemoryRichGaugeRepository reader = new InMemoryRichGaugeRepository();
|
||||
private final InMemoryMetricRepository writer = new InMemoryMetricRepository();
|
||||
private final RichGaugeExporter exporter = new RichGaugeExporter(this.reader, this.writer);
|
||||
|
||||
@Test
|
||||
public void prefixedMetricsCopied() {
|
||||
|
||||
@@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class InMemoryMetricRepositoryTests {
|
||||
|
||||
private InMemoryMetricRepository repository = new InMemoryMetricRepository();
|
||||
private final InMemoryMetricRepository repository = new InMemoryMetricRepository();
|
||||
|
||||
@Test
|
||||
public void increment() {
|
||||
|
||||
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class InMemoryPrefixMetricRepositoryTests {
|
||||
|
||||
private InMemoryMetricRepository repository = new InMemoryMetricRepository();
|
||||
private final InMemoryMetricRepository repository = new InMemoryMetricRepository();
|
||||
|
||||
@Test
|
||||
public void registeredPrefixCounted() {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class RedisServer implements TestRule {
|
||||
|
||||
protected LettuceConnectionFactory resource;
|
||||
|
||||
private String resourceDescription = "Redis ConnectionFactory";
|
||||
private final String resourceDescription = "Redis ConnectionFactory";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(RedisServer.class);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class InMemoryRichGaugeRepositoryTests {
|
||||
|
||||
private InMemoryRichGaugeRepository repository = new InMemoryRichGaugeRepository();
|
||||
private final InMemoryRichGaugeRepository repository = new InMemoryRichGaugeRepository();
|
||||
|
||||
@Test
|
||||
public void writeAndRead() {
|
||||
|
||||
@@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class InMemoryRepositoryTests {
|
||||
|
||||
private SimpleInMemoryRepository<String> repository = new SimpleInMemoryRepository<String>();
|
||||
private final SimpleInMemoryRepository<String> repository = new SimpleInMemoryRepository<String>();
|
||||
|
||||
@Test
|
||||
public void setAndGet() {
|
||||
|
||||
@@ -29,8 +29,8 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class CodahaleMetricWriterTests {
|
||||
|
||||
private MetricRegistry registry = new MetricRegistry();
|
||||
private CodahaleMetricWriter writer = new CodahaleMetricWriter(this.registry);
|
||||
private final MetricRegistry registry = new MetricRegistry();
|
||||
private final CodahaleMetricWriter writer = new CodahaleMetricWriter(this.registry);
|
||||
|
||||
@Test
|
||||
public void incrementCounter() {
|
||||
|
||||
@@ -28,9 +28,9 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class DefaultCounterServiceTests {
|
||||
|
||||
private MetricWriter repository = mock(MetricWriter.class);
|
||||
private final MetricWriter repository = mock(MetricWriter.class);
|
||||
|
||||
private DefaultCounterService service = new DefaultCounterService(this.repository);
|
||||
private final DefaultCounterService service = new DefaultCounterService(this.repository);
|
||||
|
||||
@Test
|
||||
public void incrementPrependsCounter() {
|
||||
|
||||
@@ -29,9 +29,9 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class DefaultGaugeServiceTests {
|
||||
|
||||
private MetricWriter repository = mock(MetricWriter.class);
|
||||
private final MetricWriter repository = mock(MetricWriter.class);
|
||||
|
||||
private DefaultGaugeService service = new DefaultGaugeService(this.repository);
|
||||
private final DefaultGaugeService service = new DefaultGaugeService(this.repository);
|
||||
|
||||
@Test
|
||||
public void setPrependsGauge() {
|
||||
|
||||
@@ -30,9 +30,9 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class MessageChannelMetricWriterTests {
|
||||
|
||||
private MessageChannel channel = mock(MessageChannel.class);
|
||||
private final MessageChannel channel = mock(MessageChannel.class);
|
||||
|
||||
private MessageChannelMetricWriter observer = new MessageChannelMetricWriter(
|
||||
private final MessageChannelMetricWriter observer = new MessageChannelMetricWriter(
|
||||
this.channel);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -37,9 +37,9 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class AuthenticationAuditListenerTests {
|
||||
|
||||
private AuthenticationAuditListener listener = new AuthenticationAuditListener();
|
||||
private final AuthenticationAuditListener listener = new AuthenticationAuditListener();
|
||||
|
||||
private ApplicationEventPublisher publisher = Mockito
|
||||
private final ApplicationEventPublisher publisher = Mockito
|
||||
.mock(ApplicationEventPublisher.class);
|
||||
|
||||
@Before
|
||||
|
||||
@@ -37,9 +37,9 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class AuthorizationAuditListenerTests {
|
||||
|
||||
private AuthorizationAuditListener listener = new AuthorizationAuditListener();
|
||||
private final AuthorizationAuditListener listener = new AuthorizationAuditListener();
|
||||
|
||||
private ApplicationEventPublisher publisher = Mockito
|
||||
private final ApplicationEventPublisher publisher = Mockito
|
||||
.mock(ApplicationEventPublisher.class);
|
||||
|
||||
@Before
|
||||
|
||||
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class InMemoryTraceRepositoryTests {
|
||||
|
||||
private InMemoryTraceRepository repository = new InMemoryTraceRepository();
|
||||
private final InMemoryTraceRepository repository = new InMemoryTraceRepository();
|
||||
|
||||
@Test
|
||||
public void capacityLimited() {
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.junit.Assert.assertEquals;
|
||||
*/
|
||||
public class WebRequestTraceFilterTests {
|
||||
|
||||
private WebRequestTraceFilter filter = new WebRequestTraceFilter(
|
||||
private final WebRequestTraceFilter filter = new WebRequestTraceFilter(
|
||||
new InMemoryTraceRepository());
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user