Clarify usage of @GerritConfig#value() and #values()
If the value() is given, it takes precedence over values(), i.e. values() is ignored if value() is specified. Add Javadoc and a test to clarify this behavior. Change-Id: I1bf8bd732f973a8d7106601d54680728ad1e0763
This commit is contained in:
@@ -34,7 +34,13 @@ public @interface GerritConfig {
|
|||||||
*/
|
*/
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single value. Takes precedence over values specified in {@code values}.
|
||||||
|
*/
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple values (list). Ignored if {@code value} is specified.
|
||||||
|
*/
|
||||||
String[] values() default "";
|
String[] values() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,4 +66,16 @@ public class UseGerritConfigAnnotationTest extends AbstractDaemonTest {
|
|||||||
.asList()
|
.asList()
|
||||||
.containsExactly("value-1", "value-2");
|
.containsExactly("value-1", "value-2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@GerritConfig(
|
||||||
|
name = "section.name",
|
||||||
|
value = "value-1",
|
||||||
|
values = {"value-2", "value-3"}
|
||||||
|
)
|
||||||
|
public void valueHasPrecedenceOverValues() {
|
||||||
|
assertThat(cfg.getStringList("section", null, "name"))
|
||||||
|
.asList()
|
||||||
|
.containsExactly("value-1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user