Skip to content

Commit 6f6e0d4

Browse files
committed
Merge branch '6.2.x'
2 parents 3049e6d + d782647 commit 6f6e0d4

File tree

4 files changed

+53
-25
lines changed

4 files changed

+53
-25
lines changed

spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
* @author Chris Beams
2828
* @author Sam Brannen
2929
* @since 3.2
30-
* @see org.springframework.core.testfixture.env.MockPropertySource
30+
* @see MockPropertySource
3131
*/
3232
public class MockEnvironment extends AbstractEnvironment {
3333

@@ -44,19 +44,23 @@ public MockEnvironment() {
4444

4545
/**
4646
* Set a property on the underlying {@link MockPropertySource} for this environment.
47+
* @since 6.2.8
48+
* @see MockPropertySource#setProperty(String, Object)
4749
*/
48-
public void setProperty(String key, String value) {
49-
this.propertySource.setProperty(key, value);
50+
public void setProperty(String name, Object value) {
51+
this.propertySource.setProperty(name, value);
5052
}
5153

5254
/**
53-
* Convenient synonym for {@link #setProperty} that returns the current instance.
54-
* Useful for method chaining and fluent-style use.
55+
* Convenient synonym for {@link #setProperty(String, Object)} that returns
56+
* the current instance.
57+
* <p>Useful for method chaining and fluent-style use.
5558
* @return this {@link MockEnvironment} instance
56-
* @see MockPropertySource#withProperty
59+
* @since 6.2.8
60+
* @see MockPropertySource#withProperty(String, Object)
5761
*/
58-
public MockEnvironment withProperty(String key, String value) {
59-
setProperty(key, value);
62+
public MockEnvironment withProperty(String name, Object value) {
63+
setProperty(name, value);
6064
return this;
6165
}
6266

spring-core/src/testFixtures/java/org/springframework/core/testfixture/env/MockPropertySource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
2626
* a user-provided {@link Properties} object, or if omitted during construction,
2727
* the implementation will initialize its own.
2828
*
29-
* The {@link #setProperty} and {@link #withProperty} methods are exposed for
29+
* <p>The {@link #setProperty} and {@link #withProperty} methods are exposed for
3030
* convenience, for example:
3131
* <pre class="code">
3232
* {@code
@@ -95,7 +95,7 @@ public void setProperty(String name, Object value) {
9595

9696
/**
9797
* Convenient synonym for {@link #setProperty} that returns the current instance.
98-
* Useful for method chaining and fluent-style use.
98+
* <p>Useful for method chaining and fluent-style use.
9999
* @return this {@link MockPropertySource} instance
100100
*/
101101
public MockPropertySource withProperty(String name, Object value) {

spring-test/src/main/java/org/springframework/mock/env/MockEnvironment.java

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
2626
* @author Chris Beams
2727
* @author Sam Brannen
2828
* @since 3.2
29-
* @see org.springframework.mock.env.MockPropertySource
29+
* @see MockPropertySource
3030
*/
3131
public class MockEnvironment extends AbstractEnvironment {
3232

@@ -43,19 +43,43 @@ public MockEnvironment() {
4343

4444
/**
4545
* Set a property on the underlying {@link MockPropertySource} for this environment.
46+
* @since 6.2.8
47+
* @see MockPropertySource#setProperty(String, Object)
4648
*/
47-
public void setProperty(String key, String value) {
48-
this.propertySource.setProperty(key, value);
49+
public void setProperty(String name, Object value) {
50+
this.propertySource.setProperty(name, value);
4951
}
5052

5153
/**
52-
* Convenient synonym for {@link #setProperty} that returns the current instance.
53-
* Useful for method chaining and fluent-style use.
54+
* Set a property on the underlying {@link MockPropertySource} for this environment.
55+
* @see #setProperty(String, Object)
56+
*/
57+
public void setProperty(String name, String value) {
58+
this.propertySource.setProperty(name, value);
59+
}
60+
61+
/**
62+
* Convenient synonym for {@link #setProperty(String, Object)} that returns
63+
* the current instance.
64+
* <p>Useful for method chaining and fluent-style use.
65+
* @return this {@link MockEnvironment} instance
66+
* @since 6.2.8
67+
* @see MockPropertySource#withProperty(String, Object)
68+
*/
69+
public MockEnvironment withProperty(String name, Object value) {
70+
setProperty(name, value);
71+
return this;
72+
}
73+
74+
/**
75+
* Convenient synonym for {@link #setProperty(String, String)} that returns
76+
* the current instance.
77+
* <p>Useful for method chaining and fluent-style use.
5478
* @return this {@link MockEnvironment} instance
55-
* @see MockPropertySource#withProperty
79+
* @see #withProperty(String, Object)
5680
*/
57-
public MockEnvironment withProperty(String key, String value) {
58-
setProperty(key, value);
81+
public MockEnvironment withProperty(String name, String value) {
82+
setProperty(name, value);
5983
return this;
6084
}
6185

spring-test/src/main/java/org/springframework/mock/env/MockPropertySource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
2626
* a user-provided {@link Properties} object, or if omitted during construction,
2727
* the implementation will initialize its own.
2828
*
29-
* The {@link #setProperty} and {@link #withProperty} methods are exposed for
29+
* <p>The {@link #setProperty} and {@link #withProperty} methods are exposed for
3030
* convenience, for example:
3131
* <pre class="code">
3232
* {@code
@@ -36,7 +36,7 @@
3636
*
3737
* @author Chris Beams
3838
* @since 3.1
39-
* @see org.springframework.mock.env.MockEnvironment
39+
* @see MockEnvironment
4040
*/
4141
public class MockPropertySource extends PropertiesPropertySource {
4242

@@ -95,7 +95,7 @@ public void setProperty(String name, Object value) {
9595

9696
/**
9797
* Convenient synonym for {@link #setProperty} that returns the current instance.
98-
* Useful for method chaining and fluent-style use.
98+
* <p>Useful for method chaining and fluent-style use.
9999
* @return this {@link MockPropertySource} instance
100100
*/
101101
public MockPropertySource withProperty(String name, Object value) {

0 commit comments

Comments
 (0)