GradleBuildInjectionExtension.java (spring-boot-2.7.3) | : | GradleBuildInjectionExtension.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2012-2021 the original author or authors. | * Copyright 2012-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 41 | skipping to change at line 41 | |||
* field prior to test execution. | * field prior to test execution. | |||
* | * | |||
* @author Scott Frederick | * @author Scott Frederick | |||
*/ | */ | |||
public class GradleBuildInjectionExtension implements BeforeEachCallback { | public class GradleBuildInjectionExtension implements BeforeEachCallback { | |||
private final GradleBuild gradleBuild; | private final GradleBuild gradleBuild; | |||
GradleBuildInjectionExtension() { | GradleBuildInjectionExtension() { | |||
this.gradleBuild = new GradleBuild(); | this.gradleBuild = new GradleBuild(); | |||
this.gradleBuild.gradleVersion(GradleVersions.currentOrMinimumCom patible()); | this.gradleBuild.gradleVersion(GradleVersions.minimumCompatible() ); | |||
String bootVersion = System.getProperty("springBootVersion"); | String bootVersion = System.getProperty("springBootVersion"); | |||
Assert.notNull(bootVersion, "Property 'springBootVersion' must be set in build environment"); | Assert.notNull(bootVersion, "Property 'springBootVersion' must be set in build environment"); | |||
this.gradleBuild.bootVersion(bootVersion); | this.gradleBuild.bootVersion(bootVersion); | |||
} | } | |||
@Override | @Override | |||
public void beforeEach(ExtensionContext context) throws Exception { | public void beforeEach(ExtensionContext context) throws Exception { | |||
Field field = ReflectionUtils.findField(context.getRequiredTestCl ass(), "gradleBuild"); | Field field = ReflectionUtils.findField(context.getRequiredTestCl ass(), "gradleBuild"); | |||
field.setAccessible(true); | field.setAccessible(true); | |||
field.set(context.getRequiredTestInstance(), this.gradleBuild); | field.set(context.getRequiredTestInstance(), this.gradleBuild); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |