Minor refactoring - changed class name and added immutability on the headers set

This commit is contained in:
Marcin Grzejszczak
2015-02-11 15:12:10 +01:00
parent c9eb699bc3
commit 759e9a163d
3 changed files with 8 additions and 9 deletions

View File

@@ -26,8 +26,8 @@ class CustomizableProperty<T, V> {
class StringCustomizableProperty extends CustomizableProperty<String, String> {
}
class NoOpCustomizableProperty<T> extends CustomizableProperty<T, T> {
NoOpCustomizableProperty(T value) {
class SingleTypeCustomizableProperty<T> extends CustomizableProperty<T, T> {
SingleTypeCustomizableProperty(T value) {
client(value)
server(value)
}

View File

@@ -11,7 +11,6 @@ class Headers {
}
Set<Map.Entry<String, WithValuePattern>> entries() {
//TODO: Make it immutable
return headers.entrySet()
return Collections.unmodifiableSet(headers.entrySet())
}
}

View File

@@ -4,11 +4,11 @@ import static io.coderate.accurest.dsl.internal.DelegateHelper.delegateToClosure
class WithValuePattern {
NoOpCustomizableProperty<String> equalToJson
NoOpCustomizableProperty<String> equalToXml
SingleTypeCustomizableProperty<String> equalToJson
SingleTypeCustomizableProperty<String> equalToXml
StringCustomizableProperty matchesXPath
NoOpCustomizableProperty<JSONCompareMode> jsonCompareMode
NoOpCustomizableProperty<String> equalTo
SingleTypeCustomizableProperty<JSONCompareMode> jsonCompareMode
SingleTypeCustomizableProperty<String> equalTo
StringCustomizableProperty contains
StringCustomizableProperty matches
StringCustomizableProperty doesNotMatch
@@ -20,7 +20,7 @@ class WithValuePattern {
// }
//
void equalTo(String equalTo) {
this.equalTo = new NoOpCustomizableProperty(equalTo)
this.equalTo = new SingleTypeCustomizableProperty(equalTo)
}
// void equalToXml(String equalToXml) {