From 8e0af5b71573d2879216365d4d56da2b32a99dcc Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 15 Nov 2018 16:29:15 +0100 Subject: [PATCH] Fixed invalid versions for compatibility verifier --- .../SpringBootDependencyTests.java | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java index 5755be40..f839e3d7 100644 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java +++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java @@ -1,10 +1,10 @@ /* * Copyright 2002-2018 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 + * Licensed under the Apache License, Version 2.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.1 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the @@ -25,12 +25,12 @@ public class SpringBootDependencyTests { @Test public void should_read_concrete_version_from_manifest() { - List acceptedVersions = Collections.singletonList("2.0.3.RELEASE"); + List acceptedVersions = Collections.singletonList("2.1.3.RELEASE"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override String getVersionFromManifest() { - return "2.0.3.RELEASE"; + return "2.1.3.RELEASE"; } }; versionVerifier.ACCEPTED_VERSIONS.clear(); @@ -43,25 +43,7 @@ public class SpringBootDependencyTests { @Test public void should_read_concrete_version_from_manifest_and_return_false_when_version_is_not_matched() { - List acceptedVersions = Collections.singletonList("2.0.9.RELEASE"); - SpringBootVersionVerifier - versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { - @Override - String getVersionFromManifest() { - return "2.0.3.RELEASE"; - } - }; - versionVerifier.ACCEPTED_VERSIONS.clear(); - - VerificationResult verificationResult = versionVerifier.verify(); - - BDDAssertions.then(verificationResult.description).isNotEmpty(); - BDDAssertions.then(verificationResult.action).isNotEmpty(); - } - - @Test - public void should_read_concrete_version_from_manifest_and_return_false_when_minor_version_is_not_matched() { - List acceptedVersions = Collections.singletonList("2.0"); + List acceptedVersions = Collections.singletonList("2.1.9.RELEASE"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override @@ -78,13 +60,31 @@ public class SpringBootDependencyTests { } @Test - public void should_read_concrete_version_from_manifest_and_match_it_against_minor_version() { - List acceptedVersions = Collections.singletonList("2.0"); + public void should_read_concrete_version_from_manifest_and_return_false_when_minor_version_is_not_matched() { + List acceptedVersions = Collections.singletonList("2.1"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override String getVersionFromManifest() { - return "2.0.3.RELEASE"; + return "2.99.3.RELEASE"; + } + }; + versionVerifier.ACCEPTED_VERSIONS.clear(); + + VerificationResult verificationResult = versionVerifier.verify(); + + BDDAssertions.then(verificationResult.description).isNotEmpty(); + BDDAssertions.then(verificationResult.action).isNotEmpty(); + } + + @Test + public void should_read_concrete_version_from_manifest_and_match_it_against_minor_version() { + List acceptedVersions = Collections.singletonList("2.1"); + SpringBootVersionVerifier + versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { + @Override + String getVersionFromManifest() { + return "2.1.3.RELEASE"; } }; versionVerifier.ACCEPTED_VERSIONS.clear(); @@ -139,7 +139,7 @@ public class SpringBootDependencyTests { @Test public void should_match_against_current_manifest() { - List acceptedVersions = Collections.singletonList("2.0"); + List acceptedVersions = Collections.singletonList("2.1"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions); versionVerifier.ACCEPTED_VERSIONS.clear(); @@ -152,7 +152,7 @@ public class SpringBootDependencyTests { @Test public void should_match_against_current_predicate() { - List acceptedVersions = Collections.singletonList("2.0"); + List acceptedVersions = Collections.singletonList("2.1"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions){ @Override @@ -161,7 +161,7 @@ public class SpringBootDependencyTests { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("2.0", versionVerifier.is2_0()); + versionVerifier.ACCEPTED_VERSIONS.put("2.1", versionVerifier.is2_1()); VerificationResult verificationResult = versionVerifier.verify(); @@ -171,7 +171,7 @@ public class SpringBootDependencyTests { @Test public void should_match_against_current_predicate_with_version_ending_with_x() { - List acceptedVersions = Collections.singletonList("2.0.x"); + List acceptedVersions = Collections.singletonList("2.1.x"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions){ @Override @@ -180,7 +180,7 @@ public class SpringBootDependencyTests { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("2.0", versionVerifier.is2_0()); + versionVerifier.ACCEPTED_VERSIONS.put("2.1", versionVerifier.is2_1()); VerificationResult verificationResult = versionVerifier.verify(); @@ -190,7 +190,7 @@ public class SpringBootDependencyTests { @Test public void should_fail_to_match_against_predicate_for_non_current_versions() { - List acceptedVersions = Collections.singletonList("2.0"); + List acceptedVersions = Collections.singletonList("2.1"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override @@ -198,7 +198,7 @@ public class SpringBootDependencyTests { return ""; } }; - versionVerifier.ACCEPTED_VERSIONS.remove("2.0"); + versionVerifier.ACCEPTED_VERSIONS.remove("2.1"); VerificationResult verificationResult = versionVerifier.verify();