|
| 1 | +/* |
| 2 | + * Copyright 2021 - 2022 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.springframework.sbm.boot.upgrade_27_30.report.helper; |
| 17 | + |
| 18 | +import org.junit.jupiter.api.Test; |
| 19 | +import org.junit.jupiter.api.DisplayName; |
| 20 | +import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportTestSupport; |
| 21 | +import org.springframework.sbm.engine.context.ProjectContext; |
| 22 | +import org.springframework.sbm.project.resource.TestProjectContext; |
| 23 | + |
| 24 | +class MicrometerBindersReportSectionTest { |
| 25 | + @Test |
| 26 | + @DisplayName("Micrometer binders should render") |
| 27 | + void withSingleModuleApplicationShouldRender() { |
| 28 | + ProjectContext context = TestProjectContext |
| 29 | + .buildProjectContext() |
| 30 | + .withSpringBootParentOf("2.7.5") |
| 31 | + .withBuildFileHavingDependencies("io.micrometer:micrometer-core:1.10.2") |
| 32 | + .build(); |
| 33 | + |
| 34 | + SpringBootUpgradeReportTestSupport.generatedSection("Micrometer binders") |
| 35 | + .fromProjectContext(context) |
| 36 | + .shouldRenderAs(""" |
| 37 | + === Micrometer binders |
| 38 | + |
| 39 | + ==== What Changed |
| 40 | + The Micrometer team moved the binders to a separate micrometer module named `micrometer-binders`. |
| 41 | + To prevent split packages, the imports have changed, too. If you are using the old binders, please adjust your imports from `io.micrometer.core.instrument.binder` to `io.micrometer.binder`. |
| 42 | + |
| 43 | + ==== Why is the application affected |
| 44 | + Actually, we don't know if the scanned application is really affected by this change. |
| 45 | + But we found a dependency matching regex `io\\.micrometer\\:micrometer-.*`. |
| 46 | + This indicates that the scanned application might be affected. |
| 47 | + |
| 48 | + ==== Remediation |
| 49 | + [IMPORTANT] |
| 50 | + ==== |
| 51 | + This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#micrometer-binders[Spring Boot 3.0 Migration Guide^, role="ext-link"]. + |
| 52 | + **Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/628[#628^, role="ext-link"]** |
| 53 | + ==== |
| 54 | + |
| 55 | +
|
| 56 | + """); |
| 57 | + } |
| 58 | + |
| 59 | + @Test |
| 60 | + @DisplayName("Micrometer binders should not render") |
| 61 | + void shouldNotRender() { |
| 62 | + ProjectContext context = TestProjectContext |
| 63 | + .buildProjectContext() |
| 64 | + .build(); |
| 65 | + |
| 66 | + SpringBootUpgradeReportTestSupport.generatedSection("Micrometer binders") |
| 67 | + .fromProjectContext(context) |
| 68 | + .shouldNotRender(); |
| 69 | + } |
| 70 | +} |
0 commit comments