|
| 1 | +/* |
| 2 | + * Copyright 2017-present 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 |
| 13 | + * or implied. See the License for the specific language governing |
| 14 | + * permissions and limitations under the License. |
| 15 | + */ |
| 16 | +package example.app.crm.config.testcontainers; |
| 17 | + |
| 18 | +import static org.assertj.core.api.Assertions.assertThat; |
| 19 | + |
| 20 | +import org.junit.jupiter.api.Test; |
| 21 | + |
| 22 | +/** |
| 23 | + * Unit Tests for {@link VmwHarborProxyImageNameSubstitutor}. |
| 24 | + * |
| 25 | + * @author John Blum |
| 26 | + * @see org.junit.Test |
| 27 | + * @see example.app.crm.config.testcontainers.VmwHarborProxyImageNameSubstitutor |
| 28 | + * @since 1.7.6 |
| 29 | + */ |
| 30 | +public class VmwHarborProxyImageNameSubstitutorUnitTests { |
| 31 | + |
| 32 | + @Test |
| 33 | + public void toUnqualifiedDockerImageNameFromQualifiedName() { |
| 34 | + |
| 35 | + VmwHarborProxyImageNameSubstitutor imageNameSubstitutor = new VmwHarborProxyImageNameSubstitutor(); |
| 36 | + |
| 37 | + String qualifiedDockerImageName = String.format(VmwHarborProxyImageNameSubstitutor |
| 38 | + .TESTCONTAINERS_HUB_IMAGE_NAME_TEMPLATE, "testcontainers/ryuk:0.4.0"); |
| 39 | + |
| 40 | + assertThat(imageNameSubstitutor.toUnqualifiedDockerImageName(qualifiedDockerImageName)) |
| 41 | + .isEqualTo("testcontainers/ryuk:0.4.0"); |
| 42 | + } |
| 43 | + |
| 44 | + @Test |
| 45 | + public void toUnqualifiedDockerImageNameFromUnqualifiedName() { |
| 46 | + |
| 47 | + VmwHarborProxyImageNameSubstitutor imageNameSubstitutor = new VmwHarborProxyImageNameSubstitutor(); |
| 48 | + |
| 49 | + assertThat(imageNameSubstitutor.toUnqualifiedDockerImageName("testcontainers/ryuk:0.4.0")) |
| 50 | + .isEqualTo("testcontainers/ryuk:0.4.0"); |
| 51 | + } |
| 52 | +} |
0 commit comments