Apply latest eclipse cleanup rules

pull/252/head
Phillip Webb 11 years ago
parent 0ac5a7595b
commit 0160760568

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.audit;
import java.util.Collections;
import org.junit.Test;
import org.springframework.boot.actuate.audit.AuditEvent;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@ -19,8 +19,6 @@ package org.springframework.boot.actuate.audit;
import java.util.Date;
import org.junit.Test;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.boot.actuate.audit.InMemoryAuditEventRepository;
import static org.junit.Assert.assertEquals;

@ -21,8 +21,6 @@ import java.util.Collections;
import org.junit.Test;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.boot.actuate.audit.AuditEventRepository;
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
import org.springframework.boot.actuate.audit.listener.AuditListener;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure;
import org.junit.Test;
import org.springframework.boot.actuate.audit.AuditEventRepository;
import org.springframework.boot.actuate.audit.InMemoryAuditEventRepository;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.security.AuthenticationAuditListener;
import org.springframework.boot.actuate.security.AuthorizationAuditListener;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure;
import org.junit.Test;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.properties.ManagementServerProperties;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

@ -22,7 +22,6 @@ import javax.servlet.FilterChain;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.boot.actuate.metrics.GaugeService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.autoconfigure;
import org.junit.Test;
import org.springframework.boot.actuate.autoconfigure.TraceRepositoryAutoConfiguration;
import org.springframework.boot.actuate.trace.InMemoryTraceRepository;
import org.springframework.boot.actuate.trace.TraceRepository;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@ -17,8 +17,6 @@
package org.springframework.boot.actuate.autoconfigure;
import org.junit.Test;
import org.springframework.boot.actuate.autoconfigure.TraceRepositoryAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.TraceWebFilterAutoConfiguration;
import org.springframework.boot.actuate.trace.WebRequestTraceFilter;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@ -24,8 +24,8 @@ import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfigur
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint;
import org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpointTests.TestConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -27,8 +27,8 @@ import org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.mvc.JolokiaEndpointTests.Config;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@ -17,7 +17,6 @@
package org.springframework.boot.actuate.health;
import org.junit.Test;
import org.springframework.boot.actuate.health.VanillaHealthIndicator;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

@ -20,7 +20,6 @@ import java.util.Date;
import org.junit.Test;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
import org.springframework.boot.actuate.metrics.writer.Delta;
import static org.junit.Assert.assertEquals;

@ -18,9 +18,6 @@ package org.springframework.boot.actuate.metrics.writer;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.boot.actuate.metrics.writer.DefaultCounterService;
import org.springframework.boot.actuate.metrics.writer.Delta;
import org.springframework.boot.actuate.metrics.writer.MetricWriter;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

@ -20,8 +20,6 @@ import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.springframework.boot.actuate.trace.InMemoryTraceRepository;
import org.springframework.boot.actuate.trace.Trace;
import static org.junit.Assert.assertEquals;

@ -21,8 +21,6 @@ import java.util.Locale;
import java.util.Map;
import org.junit.Test;
import org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.MapPropertySource;

@ -39,8 +39,8 @@ import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.test.City;

@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.batch;
import org.junit.Test;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.boot.autoconfigure.batch.JobExecutionEvent;
import org.springframework.boot.autoconfigure.batch.JobExecutionExitCodeGenerator;
import static org.junit.Assert.assertEquals;

@ -19,8 +19,8 @@ package org.springframework.boot.autoconfigure.data;
import javax.persistence.EntityManagerFactory;
import org.junit.Test;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.jpa.City;
import org.springframework.boot.autoconfigure.data.jpa.CityRepository;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;

@ -17,8 +17,8 @@
package org.springframework.boot.autoconfigure.data;
import org.junit.Test;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.jpa.City;
import org.springframework.boot.autoconfigure.data.jpa.CityRepository;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;

@ -17,8 +17,8 @@
package org.springframework.boot.autoconfigure.data;
import org.junit.Test;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.mongo.City;
import org.springframework.boot.autoconfigure.data.mongo.CityRepository;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.jdbc;
import javax.sql.DataSource;
import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.CommonsDataSourceConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import static org.junit.Assert.assertNotNull;

@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.jdbc;
import javax.sql.DataSource;
import org.junit.Test;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import static org.junit.Assert.assertNotNull;

@ -17,10 +17,10 @@
package org.springframework.boot.autoconfigure.reactor;
import org.junit.Test;
import org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import reactor.core.Reactor;
import static org.junit.Assert.assertNotNull;
/**

@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.security;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationBeforeRefreshEvent;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.AutoConfigurationReportLoggingInitializer;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.test.City;

@ -22,7 +22,6 @@ import java.util.Map;
import org.junit.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.boot.bind.RelaxedDataBinder;
import org.springframework.core.convert.support.DefaultConversionService;

@ -132,6 +132,7 @@ public final class CommandLineInvoker {
this.output = buffer;
}
@Override
public void run() {
int read;
try {

@ -16,8 +16,6 @@
package sample.actuator;
import static org.junit.Assert.assertNotNull;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@ -30,6 +28,8 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.endpoint.MetricsEndpoint;
import org.springframework.context.ConfigurableApplicationContext;
import static org.junit.Assert.assertNotNull;
/**
* Basic integration tests for service demo application.
*

@ -16,8 +16,6 @@
package sample.actuator.ui;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.Callable;
@ -29,7 +27,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.ui.SampleActuatorUiApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -37,6 +34,8 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
/**
* Integration tests for separate management and main service ports.
*

@ -28,7 +28,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.ui.SampleActuatorUiApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;

@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;

@ -16,8 +16,6 @@
package sample.actuator;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -32,7 +30,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
@ -46,6 +43,8 @@ import org.springframework.security.crypto.codec.Base64;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
/**
* Integration tests for separate management and main service ports.
*

@ -27,7 +27,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

@ -30,7 +30,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;

@ -16,11 +16,6 @@
package sample.actuator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ -36,7 +31,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@ -54,6 +48,11 @@ import org.springframework.security.crypto.codec.Base64;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for service demo application.
*

@ -30,7 +30,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;

@ -16,10 +16,6 @@
package sample.actuator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.Callable;
@ -31,7 +27,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -39,6 +34,10 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Integration tests for unsecured service endpoints (even with Spring Security on
* classpath).

@ -27,7 +27,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.actuator.SampleActuatorApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

@ -20,10 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import sample.aop.service.HelloWorldService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import sample.aop.service.HelloWorldService;
@Configuration
@EnableAutoConfiguration
@ComponentScan

@ -22,7 +22,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import sample.aop.SampleAopApplication;
import static org.junit.Assert.assertTrue;
/**

@ -16,11 +16,12 @@
package sample.data.jpa.service;
import sample.data.jpa.domain.City;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import sample.data.jpa.domain.City;
interface CityRepository extends Repository<City, Long> {
Page<City> findAll(Pageable pageable);

@ -16,11 +16,12 @@
package sample.data.jpa.service;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.HotelSummary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.HotelSummary;
public interface CityService {
Page<City> findCities(CitySearchCriteria criteria, Pageable pageable);

@ -17,8 +17,6 @@
package sample.data.jpa.service;
import org.springframework.beans.factory.annotation.Autowired;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.HotelSummary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
@ -26,6 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.HotelSummary;
@Component("cityService")
@Transactional
class CityServiceImpl implements CityService {

@ -16,12 +16,13 @@
package sample.data.jpa.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.Review;
import sample.data.jpa.domain.ReviewDetails;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface HotelService {

@ -21,17 +21,18 @@ import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.Rating;
import sample.data.jpa.domain.RatingCount;
import sample.data.jpa.domain.Review;
import sample.data.jpa.domain.ReviewDetails;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@Component("hotelService")
@Transactional

@ -16,12 +16,13 @@
package sample.data.jpa.service;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.Review;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.Review;
interface ReviewRepository extends Repository<Review, Long> {
Page<Review> findByHotel(Hotel hotel, Pageable pageable);

@ -17,12 +17,13 @@
package sample.data.jpa.web;
import org.springframework.beans.factory.annotation.Autowired;
import sample.data.jpa.service.CityService;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.data.jpa.service.CityService;
@Controller
public class SampleController {

@ -1,9 +1,5 @@
package sample.data.jpa;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -16,6 +12,10 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Integration test to run the application.
*

@ -15,20 +15,21 @@
*/
package sample.data.jpa.service;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import sample.data.jpa.SampleDataJpaApplication;
import sample.data.jpa.domain.City;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.data.jpa.SampleDataJpaApplication;
import sample.data.jpa.domain.City;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
* Integration tests for {@link CityRepository}.
*

@ -15,27 +15,28 @@
*/
package sample.data.jpa.service;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.data.jpa.SampleDataJpaApplication;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.HotelSummary;
import sample.data.jpa.domain.Rating;
import sample.data.jpa.domain.RatingCount;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
* Integration tests for {@link HotelRepository}.

@ -16,8 +16,6 @@
package sample.data.mongo;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.junit.Rule;
@ -25,6 +23,8 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
import static org.junit.Assert.assertTrue;
/**
* Tests for {@link SampleMongoApplication}.
*

@ -25,14 +25,15 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import sample.integration.SampleIntegrationApplication;
import sample.integration.producer.ProducerApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternUtils;
import org.springframework.util.StreamUtils;
import sample.integration.SampleIntegrationApplication;
import sample.integration.producer.ProducerApplication;
import static org.junit.Assert.assertTrue;
/**

@ -17,11 +17,12 @@
package sample.jetty.web;
import org.springframework.beans.factory.annotation.Autowired;
import sample.jetty.service.HelloWorldService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
@Controller
public class SampleController {

@ -20,10 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import sample.profile.service.MessageService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import sample.profile.service.MessageService;
@Configuration
@EnableAutoConfiguration
@ComponentScan

@ -16,8 +16,6 @@
package sample.secure;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -36,6 +34,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.secure.SampleSecureApplicationTests.TestConfiguration;
import static org.junit.Assert.assertEquals;
/**
* Basic integration tests for demo application.
*

@ -1,7 +1,5 @@
package sample.servlet;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -28,6 +26,8 @@ import org.springframework.security.crypto.codec.Base64;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
/**
* Basic integration tests for demo application.
*

@ -20,10 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import sample.simple.service.HelloWorldService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import sample.simple.service.HelloWorldService;
@Configuration
@EnableAutoConfiguration
@ComponentScan

@ -17,11 +17,12 @@
package sample.tomcat.web;
import org.springframework.beans.factory.annotation.Autowired;
import sample.tomcat.service.HelloWorldService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.tomcat.service.HelloWorldService;
@Controller
public class SampleController {

@ -31,8 +31,6 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import sample.tomcat.service.HelloWorldService;
import sample.tomcat.web.SampleController;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@ -43,6 +41,9 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import sample.tomcat.service.HelloWorldService;
import sample.tomcat.web.SampleController;
import static org.junit.Assert.assertEquals;
/**

@ -17,7 +17,8 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for JSP application.

@ -16,9 +16,6 @@
package sample.ops.ui;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.Callable;
@ -41,6 +38,9 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for demo application.
*

@ -63,7 +63,8 @@ public class SampleWebStaticApplicationTests {
@Test
public void testCss() throws Exception {
ResponseEntity<String> entity = getRestTemplate().getForEntity(
"http://localhost:8080/webjars/bootstrap/3.0.3/css/bootstrap.min.css", String.class);
"http://localhost:8080/webjars/bootstrap/3.0.3/css/bootstrap.min.css",
String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body:\n" + entity.getBody(), entity.getBody().contains("body"));
assertEquals("Wrong content type:\n" + entity.getHeaders().getContentType(),

@ -16,8 +16,6 @@ package sample.ui.mvc;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import sample.ui.Message;
import sample.ui.MessageRepository;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
@ -27,6 +25,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import sample.ui.Message;
import sample.ui.MessageRepository;
/**
* @author Rob Winch
*/

@ -1,12 +1,5 @@
package sample.ui;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.regex.Pattern;
import org.hamcrest.Description;
@ -22,6 +15,13 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* A Basic Spring MVC Test for the Sample Controller"
*

@ -19,17 +19,18 @@ package samples.websocket.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.handler.PerConnectionWebSocketHandler;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.echo.DefaultEchoService;
import samples.websocket.echo.EchoService;
import samples.websocket.echo.EchoWebSocketHandler;
import samples.websocket.snake.SnakeWebSocketHandler;
import org.springframework.boot.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.handler.PerConnectionWebSocketHandler;
@Configuration
@EnableAutoConfiguration

@ -49,17 +49,21 @@ public class Location {
@Override
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (o == null || getClass() != o.getClass())
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Location location = (Location) o;
if (this.x != location.x)
if (this.x != location.x) {
return false;
if (this.y != location.y)
}
if (this.y != location.y) {
return false;
}
return true;
}

@ -29,16 +29,17 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleClientWebSocketHandler;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.config.SampleWebSocketsApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import samples.websocket.client.GreetingService;
import samples.websocket.client.SimpleClientWebSocketHandler;
import samples.websocket.client.SimpleGreetingService;
import samples.websocket.config.SampleWebSocketsApplication;
import static org.junit.Assert.assertEquals;
public class SampleWebSocketsApplicationTests {

@ -19,6 +19,7 @@ package sample.xml;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import sample.xml.service.HelloWorldService;
public class SampleSpringXmlApplication implements CommandLineRunner {

@ -28,7 +28,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
/**
* Expose Gradle {@link Configuration}s as {@link Libraries}.
*
*
* @author Phillip Webb
*/
class ProjectLibraries implements Libraries {
@ -41,6 +41,7 @@ class ProjectLibraries implements Libraries {
/**
* Create a new {@link ProjectLibraries} instance of the specified {@link Project}.
*
* @param project the gradle project
*/
public ProjectLibraries(Project project) {
@ -49,6 +50,7 @@ class ProjectLibraries implements Libraries {
/**
* Set the name of the provided configuration. Defaults to 'providedRuntime'.
*
* @param providedConfigurationName the providedConfigurationName to set
*/
public void setProvidedConfigurationName(String providedConfigurationName) {

@ -30,7 +30,7 @@ import org.springframework.boot.loader.tools.Repackager;
/**
* Repackage task.
*
*
* @author Phillip Webb
*/
public class Repackage extends DefaultTask {
@ -78,13 +78,16 @@ public class Repackage extends DefaultTask {
File file = archive.getArchivePath();
if (file.exists()) {
Repackager repackager = new Repackager(file) {
protected String findMainMethod(java.util.jar.JarFile source) throws IOException {
@Override
protected String findMainMethod(java.util.jar.JarFile source)
throws IOException {
long startTime = System.currentTimeMillis();
try {
return super.findMainMethod(source);
}
finally {
long duration = System.currentTimeMillis() - startTime;
} finally {
long duration = System.currentTimeMillis()
- startTime;
if (duration > FIND_WARNING_TIMEOUT) {
getLogger().warn(
"Searching for the main-class is taking some time, "

@ -50,6 +50,8 @@ public class RunApp extends DefaultTask {
JavaPluginConvention javaConvention = project.getConvention().getPlugin(
JavaPluginConvention.class);
javaConvention.getSourceSets().all(new Action<SourceSet>() {
@Override
public void execute(SourceSet set) {
if (SourceSet.MAIN_SOURCE_SET_NAME.equals(set.getName())) {
main = set;
@ -64,10 +66,11 @@ public class RunApp extends DefaultTask {
}
project.getTasks().withType(JavaExec.class, new Action<JavaExec>() {
@Override
public void execute(JavaExec exec) {
ArrayList<File> files = new ArrayList<File>(exec.getClasspath()
.getFiles());
ArrayList<File> files = new ArrayList<File>(
exec.getClasspath().getFiles());
files.addAll(0, allResources);
getLogger().info("Adding classpath: " + allResources);
exec.setClasspath(new SimpleFileCollection(files));
@ -75,6 +78,7 @@ public class RunApp extends DefaultTask {
final String mainClass = findMainClass(main);
exec.setMain(mainClass);
exec.getConventionMapping().map("main", new Callable<String>() {
@Override
public String call() throws Exception {
return mainClass;

@ -21,9 +21,6 @@ import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.loader.tools.Layout;
import org.springframework.boot.loader.tools.Layouts;
import org.springframework.boot.loader.tools.LibraryScope;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;

@ -21,7 +21,6 @@ import java.io.ByteArrayOutputStream;
import java.util.jar.JarOutputStream;
import org.junit.Test;
import org.springframework.boot.maven.PropertiesMergingResourceTransformer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

@ -139,10 +139,11 @@ public final class RelaxedNames implements Iterable<String> {
builder.append(builder.length() == 0 ? field : StringUtils
.capitalize(field));
}
for (String suffix : new String[] { "_", "-", "." })
for (String suffix : new String[] { "_", "-", "." }) {
if (value.endsWith(suffix)) {
builder.append(suffix);
}
}
return builder.toString();
}
};

@ -19,18 +19,16 @@ package org.springframework.boot.ansi;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.ansi.AnsiOutput.Enabled;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.springframework.boot.ansi.AnsiElement.BOLD;
import static org.springframework.boot.ansi.AnsiElement.FAINT;
import static org.springframework.boot.ansi.AnsiElement.GREEN;
import static org.springframework.boot.ansi.AnsiElement.NORMAL;
import static org.springframework.boot.ansi.AnsiElement.RED;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link AnsiOutput}.
*

@ -20,7 +20,6 @@ import java.io.IOException;
import java.util.Properties;
import org.junit.Test;
import org.springframework.boot.config.ArrayDocumentMatcher;
import org.springframework.boot.config.YamlProcessor.MatchStatus;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

@ -29,7 +29,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.boot.context.embedded.MimeMappings;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

@ -25,8 +25,6 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Test;
import org.mockito.InOrder;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

@ -23,10 +23,10 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.logging.logback.ColorConverter;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.LoggingEvent;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

Loading…
Cancel
Save