From 296f9c5091bd62c39ceb81ac8c2e067a4a078aae Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Mon, 17 Dec 2018 09:03:02 +0100 Subject: [PATCH] Added as type for backward compatibility --- .../contract/spec/internal/FromFileProperty.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/FromFileProperty.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/FromFileProperty.groovy index b3416238cc..593dd19f1a 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/FromFileProperty.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/FromFileProperty.groovy @@ -66,4 +66,14 @@ class FromFileProperty implements Serializable { return this.file.bytes } + public T asType(T type) { + switch (type) { + case String: + return (T) asString() + case byte[]: + return (T) asBytes() + } + throw new UnsupportedOperationException("Can't cast to type [${type}]") + } + }