|
|
@ -60,7 +60,7 @@ public final class TestPropertyValues {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Builder method to add more properties.
|
|
|
|
* Builder method to add more properties.
|
|
|
|
* @param pairs The property pairs to add
|
|
|
|
* @param pairs the property pairs to add
|
|
|
|
* @return a new {@link TestPropertyValues} instance
|
|
|
|
* @return a new {@link TestPropertyValues} instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public TestPropertyValues and(String... pairs) {
|
|
|
|
public TestPropertyValues and(String... pairs) {
|
|
|
@ -119,7 +119,7 @@ public final class TestPropertyValues {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add the properties to the {@link System#getProperties() system properties} for the
|
|
|
|
* Add the properties to the {@link System#getProperties() system properties} for the
|
|
|
|
* duration of the {@code call}, restoring previous values then the call completes.
|
|
|
|
* duration of the {@code call}, restoring previous values when the call completes.
|
|
|
|
* @param <T> the result type
|
|
|
|
* @param <T> the result type
|
|
|
|
* @param call the call to make
|
|
|
|
* @param call the call to make
|
|
|
|
* @return the result of the call
|
|
|
|
* @return the result of the call
|
|
|
@ -158,7 +158,7 @@ public final class TestPropertyValues {
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* ("=") separators.
|
|
|
|
* ("=") separators.
|
|
|
|
* @param pairs The key value pairs for properties that need to be added to the
|
|
|
|
* @param pairs the name-value pairs for properties that need to be added to the
|
|
|
|
* environment
|
|
|
|
* environment
|
|
|
|
* @return the new instance
|
|
|
|
* @return the new instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -170,7 +170,7 @@ public final class TestPropertyValues {
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* ("=") separators.
|
|
|
|
* ("=") separators.
|
|
|
|
* @param pairs The key value pairs for properties that need to be added to the
|
|
|
|
* @param pairs the name-value pairs for properties that need to be added to the
|
|
|
|
* environment
|
|
|
|
* environment
|
|
|
|
* @return the new instance
|
|
|
|
* @return the new instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -185,7 +185,7 @@ public final class TestPropertyValues {
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* Return a new {@link TestPropertyValues} with the underlying map populated with the
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* given property pairs. Name-value pairs can be specified with colon (":") or equals
|
|
|
|
* ("=") separators.
|
|
|
|
* ("=") separators.
|
|
|
|
* @param pairs The key value pairs for properties that need to be added to the
|
|
|
|
* @param pairs the name-value pairs for properties that need to be added to the
|
|
|
|
* environment
|
|
|
|
* environment
|
|
|
|
* @return the new instance
|
|
|
|
* @return the new instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -197,7 +197,7 @@ public final class TestPropertyValues {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Return a new empty {@link TestPropertyValues} instance.
|
|
|
|
* Return an empty {@link TestPropertyValues} instance.
|
|
|
|
* @return an empty instance
|
|
|
|
* @return an empty instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static TestPropertyValues empty() {
|
|
|
|
public static TestPropertyValues empty() {
|
|
|
@ -252,9 +252,9 @@ public final class TestPropertyValues {
|
|
|
|
|
|
|
|
|
|
|
|
public static Pair parse(String pair) {
|
|
|
|
public static Pair parse(String pair) {
|
|
|
|
int index = getSeparatorIndex(pair);
|
|
|
|
int index = getSeparatorIndex(pair);
|
|
|
|
String key = (index > 0 ? pair.substring(0, index) : pair);
|
|
|
|
String name = (index > 0 ? pair.substring(0, index) : pair);
|
|
|
|
String value = (index > 0 ? pair.substring(index + 1) : "");
|
|
|
|
String value = (index > 0 ? pair.substring(index + 1) : "");
|
|
|
|
return of(key.trim(), value.trim());
|
|
|
|
return of(name.trim(), value.trim());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static int getSeparatorIndex(String pair) {
|
|
|
|
private static int getSeparatorIndex(String pair) {
|
|
|
|