Skip to content

Commit c10767d

Browse files
authored
Merge pull request #103 from iExecBlockchainComputing/bugfix/clean-version-service
Remove `VersionService#isSnapshot`
2 parents b3a128d + 597bb16 commit c10767d

File tree

3 files changed

+66
-6
lines changed

3 files changed

+66
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
- Describe upload limits configuration in README.md. (#99)
1313
### Quality
1414
- Upgrade to Gradle 8.2.1 with up-to-date plugins. (#97)
15+
- Remove `VersionService#isSnapshot`. (#103)
1516
### Dependency Upgrades
1617
- Upgrade to `eclipse-temurin` 11.0.20. (#95)
1718
- Upgrade to Spring Boot 2.7.14. (#96)

src/main/java/com/iexec/resultproxy/version/VersionService.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
package com.iexec.resultproxy.version;
1+
/*
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
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+
* http://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+
*/
216

3-
import com.iexec.common.utils.VersionUtils;
17+
package com.iexec.resultproxy.version;
418

519
import org.springframework.boot.info.BuildProperties;
620
import org.springframework.stereotype.Service;
@@ -18,8 +32,4 @@ public String getVersion() {
1832
return buildProperties.getVersion();
1933
}
2034

21-
public boolean isSnapshot() {
22-
return VersionUtils.isSnapshot(getVersion());
23-
}
24-
2535
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
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+
* http://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+
17+
package com.iexec.resultproxy.version;
18+
19+
import org.junit.jupiter.api.Assertions;
20+
import org.junit.jupiter.api.BeforeEach;
21+
import org.junit.jupiter.params.ParameterizedTest;
22+
import org.junit.jupiter.params.provider.ValueSource;
23+
import org.mockito.InjectMocks;
24+
import org.mockito.Mock;
25+
import org.mockito.Mockito;
26+
import org.mockito.MockitoAnnotations;
27+
import org.springframework.boot.info.BuildProperties;
28+
29+
class VersionServiceTests {
30+
31+
@Mock
32+
private BuildProperties buildProperties;
33+
34+
@InjectMocks
35+
private VersionService versionService;
36+
37+
@BeforeEach
38+
public void preflight() {
39+
MockitoAnnotations.openMocks(this);
40+
}
41+
42+
@ParameterizedTest
43+
@ValueSource(strings={"x.y.z", "x.y.z-rc", "x.y.z-NEXT-SNAPSHOT"})
44+
void testNonSnapshotVersion(String version) {
45+
Mockito.when(buildProperties.getVersion()).thenReturn(version);
46+
Assertions.assertEquals(version, versionService.getVersion());
47+
}
48+
49+
}

0 commit comments

Comments
 (0)