Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
2b185fc9
Commit
2b185fc9
authored
Mar 31, 2014
by
Dave Syer
Committed by
Phillip Webb
Apr 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for groovy config in @SpringApplicationConfiguration
parent
ed3fc06d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
2 deletions
+104
-2
ConfigFileApplicationContextInitializerTests.java
...ot/test/ConfigFileApplicationContextInitializerTests.java
+1
-1
SpringApplicationConfigurationGroovyConfigurationTests.java
...ringApplicationConfigurationGroovyConfigurationTests.java
+43
-0
SpringApplicationConfigurationMixedConfigurationTests.java
...pringApplicationConfigurationMixedConfigurationTests.java
+56
-0
SpringApplicationIntegrationTestTests.java
...work/boot/test/SpringApplicationIntegrationTestTests.java
+1
-1
test.groovy
spring-boot/src/test/resources/test.groovy
+3
-0
No files found.
spring-boot/src/test/java/org/springframework/boot/test/ConfigFileApplicationContextInitializerTests.java
View file @
2b185fc9
...
...
@@ -40,7 +40,7 @@ public class ConfigFileApplicationContextInitializerTests {
private
Environment
environment
;
@Test
public
void
tes
t
()
{
public
void
initializerPopulatesEnvironmen
t
()
{
assertThat
(
this
.
environment
.
getProperty
(
"foo"
),
equalTo
(
"bucket"
));
}
...
...
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationGroovyConfigurationTests.java
0 → 100644
View file @
2b185fc9
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* Tests for {@link SpringApplicationContextLoader} (detectDefaultConfigurationClasses).
*
* @author Dave Syer
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
locations
=
"classpath:test.groovy"
)
public
class
SpringApplicationConfigurationGroovyConfigurationTests
{
@Autowired
private
String
foo
;
@Test
public
void
groovyConfigLoaded
()
{
assertNotNull
(
this
.
foo
);
}
}
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationMixedConfigurationTests.java
0 → 100644
View file @
2b185fc9
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
test
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.SpringApplicationConfigurationMixedConfigurationTests.Config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* Tests for {@link SpringApplicationContextLoader}.
*
* @author Dave Syer
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
Config
.
class
,
locations
=
"classpath:test.groovy"
)
@Ignore
(
"classes and locations together are not supported in Spring Test (for legacy reasons)"
)
public
class
SpringApplicationConfigurationMixedConfigurationTests
{
@Autowired
private
String
foo
;
@Autowired
private
Config
config
;
@Test
public
void
mixedConfigClasses
()
{
assertNotNull
(
this
.
foo
);
assertNotNull
(
this
.
config
);
}
@Configuration
protected
static
class
Config
{
}
}
spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java
View file @
2b185fc9
...
...
@@ -45,7 +45,7 @@ import static org.junit.Assert.assertEquals;
public
class
SpringApplicationIntegrationTestTests
{
@Test
public
void
nestedConfigClasses
()
{
public
void
runAndTestHttpEndpoint
()
{
String
body
=
new
RestTemplate
().
getForObject
(
"http://localhost:8080/"
,
String
.
class
);
assertEquals
(
"Hello World"
,
body
);
...
...
spring-boot/src/test/resources/test.groovy
0 → 100644
View file @
2b185fc9
beans
{
foo
String
,
"World"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment