Align with Spring Framework 5's new Commons Logging adapter

Closes gh-8825
This commit is contained in:
Andy Wilkinson
2017-04-06 13:22:53 +01:00
parent 0186fb2e84
commit f0c5372642
26 changed files with 180 additions and 147 deletions

View File

@@ -155,8 +155,10 @@ public class CliTester implements TestRule {
return sources;
}
public String getOutput() {
return this.outputCapture.toString();
private String getOutput() {
String output = this.outputCapture.toString();
this.outputCapture.reset();
return output;
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,20 +33,17 @@ public class DirectorySourcesIntegrationTests {
@Test
public void runDirectory() throws Exception {
this.cli.run("code");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("code")).contains("Hello World");
}
@Test
public void runDirectoryRecursive() throws Exception {
this.cli.run("");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("")).contains("Hello World");
}
@Test
public void runPathPattern() throws Exception {
this.cli.run("**/*.groovy");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("**/*.groovy")).contains("Hello World");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,14 +47,12 @@ public class ReproIntegrationTests {
// this will fail
@Test
public void securityDependencies() throws Exception {
this.cli.run("secure.groovy");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("secure.groovy")).contains("Hello World");
}
@Test
public void dataJpaDependencies() throws Exception {
this.cli.run("data-jpa.groovy");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("data-jpa.groovy")).contains("Hello World");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,6 +59,7 @@ public class RunCommandIntegrationTests {
@Test
public void quietModeSuppressesAllCliOutput() throws Exception {
this.cli.run("quiet.groovy");
String output = this.cli.run("quiet.groovy", "-q");
assertThat(output).isEqualTo("Ssshh");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -159,8 +159,7 @@ public class SampleIntegrationTests {
@Test
public void caching() throws Exception {
this.cli.run("caching.groovy");
assertThat(this.cli.getOutput()).contains("Hello World");
assertThat(this.cli.run("caching.groovy")).contains("Hello World");
}
}

View File

@@ -105,10 +105,10 @@ public class GroovyGrabDependencyResolverTests {
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void resolveShorthandArtifactWithDependencies() throws Exception {
List<File> resolved = this.resolver.resolve(Arrays.asList("spring-core"));
List<File> resolved = this.resolver.resolve(Arrays.asList("spring-beans"));
assertThat(resolved).hasSize(2);
assertThat(getNames(resolved)).has((Condition) Matched.by(
hasItems(startsWith("commons-logging-"), startsWith("spring-core-"))));
assertThat(getNames(resolved)).has((Condition) Matched
.by(hasItems(startsWith("spring-core-"), startsWith("spring-beans-"))));
}
@Test

View File

@@ -66,8 +66,8 @@ public class AetherGrapeEngineTests {
public void dependencyResolution() {
Map<String, Object> args = new HashMap<>();
createGrapeEngine(this.springMilestones).grab(args,
createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE"));
assertThat(this.groovyClassLoader.getURLs()).hasSize(5);
createDependency("org.springframework", "spring-jdbc", null));
assertThat(this.groovyClassLoader.getURLs()).hasSize(4);
}
@Test
@@ -153,10 +153,10 @@ public class AetherGrapeEngineTests {
args.put("classLoader", customClassLoader);
createGrapeEngine(this.springMilestones).grab(args,
createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE"));
createDependency("org.springframework", "spring-jdbc", null));
assertThat(this.groovyClassLoader.getURLs().length).isEqualTo(0);
assertThat(customClassLoader.getURLs().length).isEqualTo(5);
assertThat(customClassLoader.getURLs().length).isEqualTo(4);
}
@Test