Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 25, 2023
1 parent 5f5e64d commit 3d871cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import java.security.InvalidParameterException;
import java.util.*;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Value;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -45,15 +44,15 @@ public boolean isPythonVersionSupported(String pythonVersion) {

/**
* Returns a set of the python versions supported by the Control Service, in the format: [3.7,
* 3.8, ...]. If the supportedPythonVersions configuration is not set, the method returns an
* empty set.
* 3.8, ...]. If the supportedPythonVersions configuration is not set, the method returns an empty
* set.
*
* @return A set of all python versions supported by the Control Service.
*/
public Set<String> getSupportedPythonVersions() {
return Optional.ofNullable(supportedPythonVersions)
.map(Map::keySet)
.orElse(Collections.emptySet());
.map(Map::keySet)
.orElse(Collections.emptySet());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public class SupportedPythonVersionsTest {

@Test
public void isPythonVersionSupported_noSupportedVersions() {
ReflectionTestUtils.setField(
supportedPythonVersions, SUPPORTED_PYTHON_VERSIONS, Map.of());
ReflectionTestUtils.setField(supportedPythonVersions, SUPPORTED_PYTHON_VERSIONS, Map.of());

Assertions.assertFalse(supportedPythonVersions.isPythonVersionSupported("3.7"));
}

@Test
public void isPythonVersionSupported_versionSupported() {
Map<String, DeploymentDetails> supportedVersions = Map.of("3.7", new DeploymentDetails("python:3.7-slim", "test_vdk_image"));
Map<String, DeploymentDetails> supportedVersions =
Map.of("3.7", new DeploymentDetails("python:3.7-slim", "test_vdk_image"));

ReflectionTestUtils.setField(
supportedPythonVersions, SUPPORTED_PYTHON_VERSIONS, supportedVersions);
Expand All @@ -43,7 +43,8 @@ public void isPythonVersionSupported_versionSupported() {

@Test
public void isPythonVersionSupported_versionNotInSupported() {
Map<String, DeploymentDetails> supportedVersions = Map.of("3.8", new DeploymentDetails("python:3.8-slim", "test_vdk_image"));
Map<String, DeploymentDetails> supportedVersions =
Map.of("3.8", new DeploymentDetails("python:3.8-slim", "test_vdk_image"));

ReflectionTestUtils.setField(
supportedPythonVersions, SUPPORTED_PYTHON_VERSIONS, supportedVersions);
Expand Down Expand Up @@ -118,9 +119,8 @@ public void getVdkImage_multipleSupportedVersions() {

private static Map<String, DeploymentDetails> generateSupportedPythonVersionsConf() {
return Map.of(
"3.7", new DeploymentDetails("python:3.7-slim", "test_vdk_image_3.7"),
"3.8", new DeploymentDetails("python:3.8-slim", "test_vdk_image_3.8"),
"3.9", new DeploymentDetails("python:3.9-slim", "test_vdk_image_3.9")
);
"3.7", new DeploymentDetails("python:3.7-slim", "test_vdk_image_3.7"),
"3.8", new DeploymentDetails("python:3.8-slim", "test_vdk_image_3.8"),
"3.9", new DeploymentDetails("python:3.9-slim", "test_vdk_image_3.9"));
}
}

0 comments on commit 3d871cd

Please sign in to comment.