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
bac10164
Commit
bac10164
authored
Apr 16, 2021
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish contribution
See gh-25532
parent
bd9dd9d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
33 deletions
+34
-33
MockConfigurationPropertySource.java
...xt/properties/source/MockConfigurationPropertySource.java
+1
-1
KotlinConstructorParametersBinderTests.kt
...properties/bind/KotlinConstructorParametersBinderTests.kt
+33
-32
No files found.
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java
View file @
bac10164
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
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.
...
...
spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/context/properties/bind/KotlinConstructorParametersBinderTests.kt
View file @
bac10164
...
...
@@ -26,7 +26,7 @@ class KotlinConstructorParametersBinderTests {
val
bean
=
binder
.
bind
(
"foo"
,
Bindable
.
of
(
ExampleValueBean
::
class
.
java
)).
get
()
assertThat
(
bean
.
intValue
).
isEqualTo
(
12
)
assertThat
(
bean
.
longValue
).
isEqualTo
(
34
)
assertThat
(
bean
.
booleanValue
).
isTrue
assertThat
(
bean
.
booleanValue
).
isTrue
()
assertThat
(
bean
.
stringValue
).
isEqualTo
(
"foo"
)
assertThat
(
bean
.
enumValue
).
isEqualTo
(
ExampleEnum
.
FOO_BAR
)
}
...
...
@@ -43,7 +43,7 @@ class KotlinConstructorParametersBinderTests {
Bindable
.
of
(
ExampleValueBean
::
class
.
java
)).
get
()
assertThat
(
bean
.
intValue
).
isEqualTo
(
12
)
assertThat
(
bean
.
longValue
).
isEqualTo
(
34
)
assertThat
(
bean
.
booleanValue
).
isTrue
assertThat
(
bean
.
booleanValue
).
isTrue
()
assertThat
(
bean
.
stringValue
).
isEqualTo
(
"foo"
)
assertThat
(
bean
.
enumValue
).
isEqualTo
(
ExampleEnum
.
FOO_BAR
)
}
...
...
@@ -71,7 +71,7 @@ class KotlinConstructorParametersBinderTests {
val
binder
=
Binder
(
source
)
val
bindable
=
binder
.
bind
(
"foo"
,
Bindable
.
of
(
MultipleConstructorsWithPrimaryConstructorBean
::
class
.
java
))
assertThat
(
bindable
.
isBound
).
isTrue
assertThat
(
bindable
.
isBound
).
isTrue
()
assertThat
(
bindable
.
get
().
intValue
).
isEqualTo
(
12
)
}
...
...
@@ -81,7 +81,7 @@ class KotlinConstructorParametersBinderTests {
val
binder
=
Binder
(
source
)
val
bindable
=
binder
.
bind
(
"foo"
,
Bindable
.
of
(
MultipleConstructorsBean
::
class
.
java
))
assertThat
(
bindable
.
isBound
).
isFalse
assertThat
(
bindable
.
isBound
).
isFalse
()
}
@Test
...
...
@@ -90,7 +90,7 @@ class KotlinConstructorParametersBinderTests {
val
binder
=
Binder
(
source
)
val
bindable
=
binder
.
bind
(
"foo"
,
Bindable
.
of
(
DefaultConstructorBean
::
class
.
java
))
assertThat
(
bindable
.
isBound
).
isFalse
assertThat
(
bindable
.
isBound
).
isFalse
()
}
@Test
...
...
@@ -103,7 +103,7 @@ class KotlinConstructorParametersBinderTests {
val
bean
=
binder
.
bind
(
"foo"
,
Bindable
.
of
(
ExampleNestedBean
::
class
.
java
)).
get
()
assertThat
(
bean
.
valueBean
.
intValue
).
isEqualTo
(
123
)
assertThat
(
bean
.
valueBean
.
longValue
).
isEqualTo
(
34
)
assertThat
(
bean
.
valueBean
.
booleanValue
).
isTrue
assertThat
(
bean
.
valueBean
.
booleanValue
).
isTrue
()
assertThat
(
bean
.
valueBean
.
stringValue
).
isEqualTo
(
"foo"
)
assertThat
(
bean
.
valueBean
.
enumValue
).
isNull
()
}
...
...
@@ -129,7 +129,7 @@ class KotlinConstructorParametersBinderTests {
ExamplePrimitiveDefaultBean
::
class
.
java
)).
get
()
assertThat
(
bean
.
intValue
).
isEqualTo
(
0
)
assertThat
(
bean
.
longValue
).
isEqualTo
(
0
)
assertThat
(
bean
.
booleanValue
).
isFalse
assertThat
(
bean
.
booleanValue
).
isFalse
()
assertThat
(
bean
.
stringValue
).
isEqualTo
(
"foo"
)
assertThat
(
bean
.
enumValue
).
isNull
()
}
...
...
@@ -139,7 +139,7 @@ class KotlinConstructorParametersBinderTests {
val
source
=
MockConfigurationPropertySource
(
"foo.string-value"
,
"foo"
)
val
binder
=
Binder
(
source
)
assertThat
(
binder
.
bind
(
"foo"
,
Bindable
.
of
(
ExampleDefaultValueBean
::
class
.
java
)).
isBound
).
isFalse
ExampleDefaultValueBean
::
class
.
java
)).
isBound
).
isFalse
()
}
@Test
...
...
@@ -244,4 +244,5 @@ class KotlinConstructorParametersBinderTests {
object
ExampleSingletonBean
{
var
stringValue
:
String
?
=
null
}
}
\ 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