Reformatting before starting work
(2419)
/*
*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2019 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.
@@ -31,10 +31,13 @@ class ParameterBuilderSpec extends Specification {
def "Setting properties on the builder with non-null values"() {
given:
def sut = new ParameterBuilder()
+
when:
sut."$builderMethod"(value)
+
and:
def built = sut.build()
+
then:
if (built."$property" instanceof Optional) {
assert built."$property" == Optional.of(value)
@@ -61,11 +64,14 @@ class ParameterBuilderSpec extends Specification {
def "Setting builder properties to null values preserves existing values"() {
given:
def sut = new ParameterBuilder()
+
when:
sut."$builderMethod"(value)
sut."$builderMethod"(null)
+
and:
def built = sut.build()
+
then:
if (built."$property" instanceof Optional) {
assert built."$property" == Optional.of(value)
@@ -85,16 +91,21 @@ class ParameterBuilderSpec extends Specification {
'allowableValues' | new AllowableListValues(['a'], "LIST") | 'allowableValues'
'type' | Mock(ResolvedType) | 'type'
}
+
def "Setting builder allowableValue to empty or null values preserves existing values"() {
given:
def sut = new ParameterBuilder()
+
when:
sut.allowableValues(currentValue)
sut.allowableValues(newValue)
+
and:
def built = sut.build()
+
then:
built.allowableValues == currentValue
+
where:
newValue | currentValue
new AllowableListValues([], "LIST") | new AllowableListValues(['a'], "LIST")
