Reformat code using Eclipse Mars

This commit is contained in:
Phillip Webb
2015-10-07 23:37:10 -07:00
parent e473364e4e
commit c9fb9916b8
408 changed files with 2831 additions and 2652 deletions

View File

@@ -34,8 +34,7 @@ public class DevToolsPropertiesTests {
public void additionalExcludeKeepsDefaults() {
DevToolsProperties.Restart restart = this.devToolsProperties.getRestart();
restart.setAdditionalExclude("foo/**,bar/**");
assertThat(
restart.getAllExclude(),
assertThat(restart.getAllExclude(),
arrayContaining("META-INF/maven/**", "META-INF/resources/**",
"resources/**", "static/**", "public/**", "templates/**",
"**/*Test.class", "**/*Tests.class", "git.properties", "foo/**",
@@ -55,7 +54,8 @@ public class DevToolsPropertiesTests {
DevToolsProperties.Restart restart = this.devToolsProperties.getRestart();
restart.setExclude("biz/**");
restart.setAdditionalExclude("foo/**,bar/**");
assertThat(restart.getAllExclude(), arrayContaining("biz/**", "foo/**", "bar/**"));
assertThat(restart.getAllExclude(),
arrayContaining("biz/**", "foo/**", "bar/**"));
}
}

View File

@@ -227,8 +227,8 @@ public class LocalDevToolsAutoConfigurationTests {
Object watcher = ReflectionTestUtils.getField(classPathWatcher,
"fileSystemWatcher");
@SuppressWarnings("unchecked")
Map<File, Object> folders = (Map<File, Object>) ReflectionTestUtils.getField(
watcher, "folders");
Map<File, Object> folders = (Map<File, Object>) ReflectionTestUtils
.getField(watcher, "folders");
assertThat(folders.size(), is(equalTo(2)));
assertThat(folders, hasKey(new File("src/main/java").getAbsoluteFile()));
assertThat(folders, hasKey(new File("src/test/java").getAbsoluteFile()));

View File

@@ -209,13 +209,14 @@ public class RemoteDevToolsAutoConfigurationTests {
@Bean
public HttpTunnelServer remoteDebugHttpTunnelServer() {
return new MockHttpTunnelServer(new SocketTargetServerConnection(
new RemoteDebugPortProvider()));
return new MockHttpTunnelServer(
new SocketTargetServerConnection(new RemoteDebugPortProvider()));
}
@Bean
public HttpRestartServer remoteRestartHttpRestartServer() {
SourceFolderUrlFilter sourceFolderUrlFilter = mock(SourceFolderUrlFilter.class);
SourceFolderUrlFilter sourceFolderUrlFilter = mock(
SourceFolderUrlFilter.class);
return new MockHttpRestartServer(sourceFolderUrlFilter);
}

View File

@@ -80,7 +80,8 @@ public class ClassPathFileChangeListenerTests {
public void restartStrategyMustNotBeNull() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("RestartStrategy must not be null");
new ClassPathFileChangeListener(this.eventPublisher, null, this.fileSystemWatcher);
new ClassPathFileChangeListener(this.eventPublisher, null,
this.fileSystemWatcher);
}
@Test

View File

@@ -99,8 +99,8 @@ public class ClassPathFileSystemWatcherTests {
public ClassPathFileSystemWatcher watcher() {
FileSystemWatcher watcher = new FileSystemWatcher(false, 100, 10);
URL[] urls = this.environemnt.getProperty("urls", URL[].class);
return new ClassPathFileSystemWatcher(new MockFileSystemWatcherFactory(
watcher), restartStrategy(), urls);
return new ClassPathFileSystemWatcher(
new MockFileSystemWatcherFactory(watcher), restartStrategy(), urls);
}
@Bean
@@ -137,7 +137,8 @@ public class ClassPathFileSystemWatcherTests {
}
private static class MockFileSystemWatcherFactory implements FileSystemWatcherFactory {
private static class MockFileSystemWatcherFactory
implements FileSystemWatcherFactory {
private final FileSystemWatcher watcher;

View File

@@ -76,7 +76,8 @@ public class PatternClassPathRestartStrategyTests {
@Test
public void testChange() {
ClassPathRestartStrategy strategy = createStrategy("**/*Test.class,**/*Tests.class");
ClassPathRestartStrategy strategy = createStrategy(
"**/*Test.class,**/*Tests.class");
assertRestartRequired(strategy, "com/example/ExampleTests.class", false);
assertRestartRequired(strategy, "com/example/ExampleTest.class", false);
assertRestartRequired(strategy, "com/example/Example.class", true);

View File

@@ -55,8 +55,8 @@ public class DevToolsHomePropertiesPostProcessorTests {
public void loadsHomeProperties() throws Exception {
Properties properties = new Properties();
properties.put("abc", "def");
OutputStream out = new FileOutputStream(new File(this.home,
".spring-boot-devtools.properties"));
OutputStream out = new FileOutputStream(
new File(this.home, ".spring-boot-devtools.properties"));
properties.store(out, null);
out.close();
ConfigurableEnvironment environment = new MockEnvironment();
@@ -73,8 +73,8 @@ public class DevToolsHomePropertiesPostProcessorTests {
assertThat(environment.getProperty("abc"), nullValue());
}
private class MockDevToolHomePropertiesPostProcessor extends
DevToolsHomePropertiesPostProcessor {
private class MockDevToolHomePropertiesPostProcessor
extends DevToolsHomePropertiesPostProcessor {
@Override
protected File getHomeFolder() {

View File

@@ -113,8 +113,8 @@ public class FileSystemWatcherTests {
File folder = new File("does/not/exist");
assertThat(folder.exists(), is(false));
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Folder '" + folder
+ "' must exist and must be a directory");
this.thrown.expectMessage(
"Folder '" + folder + "' must exist and must be a directory");
this.watcher.addSourceFolder(folder);
}

View File

@@ -108,8 +108,8 @@ public class FolderSnapshotTests {
public void getChangedFilesSnapshotMustBeTheSameSourceFolder() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Snapshot source folder must be '" + this.folder + "'");
this.initialSnapshot.getChangedFiles(new FolderSnapshot(
createTestFolderStructure()), null);
this.initialSnapshot
.getChangedFiles(new FolderSnapshot(createTestFolderStructure()), null);
}
@Test

View File

@@ -138,8 +138,8 @@ public class ClassPathChangeUploaderTests {
return file;
}
private ClassLoaderFiles deserialize(byte[] bytes) throws IOException,
ClassNotFoundException {
private ClassLoaderFiles deserialize(byte[] bytes)
throws IOException, ClassNotFoundException {
ObjectInputStream objectInputStream = new ObjectInputStream(
new ByteArrayInputStream(bytes));
return (ClassLoaderFiles) objectInputStream.readObject();

View File

@@ -75,8 +75,8 @@ public class DelayedLiveReloadTriggerTests {
MockitoAnnotations.initMocks(this);
given(this.errorRequest.execute()).willReturn(this.errorResponse);
given(this.okRequest.execute()).willReturn(this.okResponse);
given(this.errorResponse.getStatusCode()).willReturn(
HttpStatus.INTERNAL_SERVER_ERROR);
given(this.errorResponse.getStatusCode())
.willReturn(HttpStatus.INTERNAL_SERVER_ERROR);
given(this.okResponse.getStatusCode()).willReturn(HttpStatus.OK);
this.trigger = new DelayedLiveReloadTrigger(this.liveReloadServer,
this.requestFactory, URL);
@@ -112,8 +112,9 @@ public class DelayedLiveReloadTriggerTests {
@Test
public void triggerReloadOnStatus() throws Exception {
given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET)).willThrow(
new IOException()).willReturn(this.errorRequest, this.okRequest);
given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET))
.willThrow(new IOException())
.willReturn(this.errorRequest, this.okRequest);
long startTime = System.currentTimeMillis();
this.trigger.setTimings(10, 200, 30000);
this.trigger.run();
@@ -123,8 +124,8 @@ public class DelayedLiveReloadTriggerTests {
@Test
public void timeout() throws Exception {
given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET)).willThrow(
new IOException());
given(this.requestFactory.createRequest(new URI(URL), HttpMethod.GET))
.willThrow(new IOException());
this.trigger.setTimings(10, 0, 10);
this.trigger.run();
verify(this.liveReloadServer, never()).triggerReload();

View File

@@ -91,8 +91,8 @@ public class DispatcherTests {
@Test
public void accessManagerVetoRequest() throws Exception {
given(this.accessManager.isAllowed(any(ServerHttpRequest.class))).willReturn(
false);
given(this.accessManager.isAllowed(any(ServerHttpRequest.class)))
.willReturn(false);
HandlerMapper mapper = mock(HandlerMapper.class);
Handler handler = mock(Handler.class);
given(mapper.getHandler(any(ServerHttpRequest.class))).willReturn(handler);

View File

@@ -57,10 +57,10 @@ public class ChangeableUrlsTests {
@Test
public void skipsUrls() throws Exception {
ChangeableUrls urls = ChangeableUrls
.fromUrls(makeUrl("spring-boot"), makeUrl("spring-boot-autoconfigure"),
makeUrl("spring-boot-actuator"), makeUrl("spring-boot-starter"),
makeUrl("spring-boot-starter-some-thing"));
ChangeableUrls urls = ChangeableUrls.fromUrls(makeUrl("spring-boot"),
makeUrl("spring-boot-autoconfigure"), makeUrl("spring-boot-actuator"),
makeUrl("spring-boot-starter"),
makeUrl("spring-boot-starter-some-thing"));
assertThat(urls.size(), equalTo(0));
}

View File

@@ -63,7 +63,8 @@ public class DefaultRestartInitializerTests {
@Test
public void threadNotUsingAppClassLoader() throws Exception {
MockRestartInitializer initializer = new MockRestartInitializer(false);
ClassLoader classLoader = new MockLauncherClassLoader(getClass().getClassLoader());
ClassLoader classLoader = new MockLauncherClassLoader(
getClass().getClassLoader());
Thread thread = new Thread();
thread.setName("main");
thread.setContextClassLoader(classLoader);

View File

@@ -62,8 +62,8 @@ public class MainMethodTests {
}
}).test();
assertThat(method.getMethod(), equalTo(this.actualMain));
assertThat(method.getDeclaringClassName(), equalTo(this.actualMain
.getDeclaringClass().getName()));
assertThat(method.getDeclaringClassName(),
equalTo(this.actualMain.getDeclaringClass().getName()));
}
@Test

View File

@@ -68,7 +68,8 @@ public class MockRestarter implements TestRule {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
String name = (String) invocation.getArguments()[0];
ObjectFactory factory = (ObjectFactory) invocation.getArguments()[1];
ObjectFactory factory = (ObjectFactory) invocation
.getArguments()[1];
Object attribute = MockRestarter.this.attributes.get(name);
if (attribute == null) {
attribute = factory.getObject();

View File

@@ -85,7 +85,8 @@ public class RestartApplicationListenerTests {
Restarter.clearInstance();
RestartApplicationListener listener = new RestartApplicationListener();
SpringApplication application = new SpringApplication();
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
ConfigurableApplicationContext context = mock(
ConfigurableApplicationContext.class);
listener.onApplicationEvent(new ApplicationStartedEvent(application, ARGS));
assertThat(Restarter.getInstance(), not(nullValue()));
assertThat(Restarter.getInstance().isFinished(), equalTo(false));
@@ -94,8 +95,8 @@ public class RestartApplicationListenerTests {
context, new RuntimeException()));
}
else {
listener.onApplicationEvent(new ApplicationReadyEvent(application, ARGS,
context));
listener.onApplicationEvent(
new ApplicationReadyEvent(application, ARGS, context));
}
}

View File

@@ -69,8 +69,8 @@ public class RestartScopeInitializerTests {
}
public static class ScopeTestBean implements
ApplicationListener<ContextRefreshedEvent> {
public static class ScopeTestBean
implements ApplicationListener<ContextRefreshedEvent> {
public ScopeTestBean() {
createCount.incrementAndGet();

View File

@@ -129,8 +129,8 @@ public class ClassLoaderFilesTests {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(this.files);
oos.close();
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
bos.toByteArray()));
ObjectInputStream ois = new ObjectInputStream(
new ByteArrayInputStream(bos.toByteArray()));
ClassLoaderFiles readObject = (ClassLoaderFiles) ois.readObject();
assertThat(readObject.getFile("myfile"), notNullValue());
}

View File

@@ -112,29 +112,30 @@ public class RestartClassLoaderTests {
@Test
public void getResourceFromReloadableUrl() throws Exception {
String content = readString(this.reloadClassLoader
.getResourceAsStream(PACKAGE_PATH + "/Sample.txt"));
String content = readString(
this.reloadClassLoader.getResourceAsStream(PACKAGE_PATH + "/Sample.txt"));
assertThat(content, startsWith("fromchild"));
}
@Test
public void getResourceFromParent() throws Exception {
String content = readString(this.reloadClassLoader
.getResourceAsStream(PACKAGE_PATH + "/Parent.txt"));
String content = readString(
this.reloadClassLoader.getResourceAsStream(PACKAGE_PATH + "/Parent.txt"));
assertThat(content, startsWith("fromparent"));
}
@Test
public void getResourcesFiltersDuplicates() throws Exception {
List<URL> resources = toList(this.reloadClassLoader.getResources(PACKAGE_PATH
+ "/Sample.txt"));
List<URL> resources = toList(
this.reloadClassLoader.getResources(PACKAGE_PATH + "/Sample.txt"));
assertThat(resources.size(), equalTo(1));
}
@Test
public void loadClassFromReloadableUrl() throws Exception {
Class<?> loaded = this.reloadClassLoader.loadClass(PACKAGE + ".Sample");
assertThat(loaded.getClassLoader(), equalTo((ClassLoader) this.reloadClassLoader));
assertThat(loaded.getClassLoader(),
equalTo((ClassLoader) this.reloadClassLoader));
}
@Test
@@ -203,11 +204,12 @@ public class RestartClassLoaderTests {
@Test
public void getAddedClass() throws Exception {
String name = PACKAGE_PATH + "/SampleParent.class";
byte[] bytes = FileCopyUtils.copyToByteArray(getClass().getResourceAsStream(
"SampleParent.class"));
byte[] bytes = FileCopyUtils
.copyToByteArray(getClass().getResourceAsStream("SampleParent.class"));
this.updatedFiles.addFile(name, new ClassLoaderFile(Kind.ADDED, bytes));
Class<?> loaded = this.reloadClassLoader.loadClass(PACKAGE + ".SampleParent");
assertThat(loaded.getClassLoader(), equalTo((ClassLoader) this.reloadClassLoader));
assertThat(loaded.getClassLoader(),
equalTo((ClassLoader) this.reloadClassLoader));
}
private String readString(InputStream in) throws IOException {

View File

@@ -37,6 +37,7 @@ public class DefaultSourceFolderUrlFilterTests {
private static final String SOURCE_ROOT = "/Users/me/code/some-root/";
private static final List<String> COMMON_POSTFIXES;
static {
List<String> postfixes = new ArrayList<String>();
postfixes.add(".jar");
@@ -92,9 +93,10 @@ public class DefaultSourceFolderUrlFilterTests {
urls.add(new URL("file:/some/path/" + name));
urls.add(new URL("file:/some/path/" + name + "!/"));
for (String postfix : COMMON_POSTFIXES) {
urls.add(new URL("jar:file:/some/path/lib-module" + postfix + "!/lib/" + name));
urls.add(new URL("jar:file:/some/path/lib-module" + postfix + "!/lib/" + name
+ "!/"));
urls.add(new URL(
"jar:file:/some/path/lib-module" + postfix + "!/lib/" + name));
urls.add(new URL(
"jar:file:/some/path/lib-module" + postfix + "!/lib/" + name + "!/"));
}
return urls;
}

View File

@@ -105,13 +105,13 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory {
}
public ClientHttpResponse asHttpResponse(AtomicLong seq) {
MockClientHttpResponse httpResponse = new MockClientHttpResponse(
this.payload, this.status);
MockClientHttpResponse httpResponse = new MockClientHttpResponse(this.payload,
this.status);
waitForDelay();
if (this.payload != null) {
httpResponse.getHeaders().setContentLength(this.payload.length);
httpResponse.getHeaders().setContentType(
MediaType.APPLICATION_OCTET_STREAM);
httpResponse.getHeaders()
.setContentType(MediaType.APPLICATION_OCTET_STREAM);
httpResponse.getHeaders().add("x-seq",
Long.toString(seq.incrementAndGet()));
}

View File

@@ -121,8 +121,8 @@ public class HttpTunnelPayloadTests {
@Test
public void getPayloadData() throws Exception {
ReadableByteChannel channel = Channels.newChannel(new ByteArrayInputStream(
"hello".getBytes()));
ReadableByteChannel channel = Channels
.newChannel(new ByteArrayInputStream("hello".getBytes()));
ByteBuffer payloadData = HttpTunnelPayload.getPayloadData(channel);
ByteArrayOutputStream out = new ByteArrayOutputStream();
WritableByteChannel writeChannel = Channels.newChannel(out);

View File

@@ -304,11 +304,11 @@ public class HttpTunnelServerTests {
testHttpConnectionNonAsync(100);
}
private void testHttpConnectionNonAsync(long sleepBeforeResponse) throws IOException,
InterruptedException {
private void testHttpConnectionNonAsync(long sleepBeforeResponse)
throws IOException, InterruptedException {
ServerHttpRequest request = mock(ServerHttpRequest.class);
given(request.getAsyncRequestControl(this.response)).willThrow(
new IllegalArgumentException());
given(request.getAsyncRequestControl(this.response))
.willThrow(new IllegalArgumentException());
final HttpConnection connection = new HttpConnection(request, this.response);
final AtomicBoolean responded = new AtomicBoolean();
Thread connectionThread = new Thread() {