Skip to content

Commit efab08a

Browse files
committed
Apply code formatting to ClustersExtTest
1 parent 049d7e0 commit efab08a

1 file changed

Lines changed: 47 additions & 35 deletions

File tree

databricks-sdk-java/src/test/java/com/databricks/sdk/mixin/ClustersExtTest.java

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -123,44 +123,51 @@ void nullComparisonTest() {
123123
private GetSparkVersionsResponse testGetSparkVersionsWithSparkVersion() {
124124
Collection<SparkVersion> versions = new ArrayList<>();
125125
// Mock realistic Databricks Runtime versions based on actual API response format
126-
versions.add(new SparkVersion()
127-
.setName("12.2 LTS (includes Apache Spark 3.3.2, Scala 2.12)")
128-
.setKey("12.2.x-scala2.12"));
129-
versions.add(new SparkVersion()
130-
.setName("13.3 LTS (includes Apache Spark 3.4.1, Scala 2.12)")
131-
.setKey("13.3.x-scala2.12"));
132-
versions.add(new SparkVersion()
133-
.setName("14.3 LTS (includes Apache Spark 3.5.0, Scala 2.12)")
134-
.setKey("14.3.x-scala2.12"));
135-
versions.add(new SparkVersion()
136-
.setName("14.2 ML (includes Apache Spark 3.5.0, Scala 2.12)")
137-
.setKey("14.2.x-cpu-ml-scala2.12"));
126+
versions.add(
127+
new SparkVersion()
128+
.setName("12.2 LTS (includes Apache Spark 3.3.2, Scala 2.12)")
129+
.setKey("12.2.x-scala2.12"));
130+
versions.add(
131+
new SparkVersion()
132+
.setName("13.3 LTS (includes Apache Spark 3.4.1, Scala 2.12)")
133+
.setKey("13.3.x-scala2.12"));
134+
versions.add(
135+
new SparkVersion()
136+
.setName("14.3 LTS (includes Apache Spark 3.5.0, Scala 2.12)")
137+
.setKey("14.3.x-scala2.12"));
138+
versions.add(
139+
new SparkVersion()
140+
.setName("14.2 ML (includes Apache Spark 3.5.0, Scala 2.12)")
141+
.setKey("14.2.x-cpu-ml-scala2.12"));
138142
// Add another version with same Spark version to create multiple matches
139-
versions.add(new SparkVersion()
140-
.setName("14.1 (includes Apache Spark 3.5.0, Scala 2.12)")
141-
.setKey("14.1.x-scala2.12"));
143+
versions.add(
144+
new SparkVersion()
145+
.setName("14.1 (includes Apache Spark 3.5.0, Scala 2.12)")
146+
.setKey("14.1.x-scala2.12"));
142147
return new GetSparkVersionsResponse().setVersions(versions);
143148
}
144149

145150
@Test
146151
void sparkVersionWithSparkVersionParameter() {
147152
ClustersExt clustersExt = new ClustersExt(clustersMock);
148153
Mockito.doReturn(testGetSparkVersionsWithSparkVersion()).when(clustersMock).sparkVersions();
149-
154+
150155
// Test exact spark version match
151-
String sparkVersion = clustersExt.selectSparkVersion(
152-
new SparkVersionSelector().withSparkVersion("3.4.1"));
156+
String sparkVersion =
157+
clustersExt.selectSparkVersion(new SparkVersionSelector().withSparkVersion("3.4.1"));
153158
assertEquals("13.3.x-scala2.12", sparkVersion);
154159
}
155160

156161
@Test
157162
void sparkVersionWithSparkVersionParameterMultipleMatches() {
158163
ClustersExt clustersExt = new ClustersExt(clustersMock);
159164
Mockito.doReturn(testGetSparkVersionsWithSparkVersion()).when(clustersMock).sparkVersions();
160-
161-
// Test spark version with multiple matches - should return latest when latest=true is explicitly set
162-
String sparkVersion = clustersExt.selectSparkVersion(
163-
new SparkVersionSelector().withSparkVersion("3.5.0").withLatest());
165+
166+
// Test spark version with multiple matches - should return latest when latest=true is
167+
// explicitly set
168+
String sparkVersion =
169+
clustersExt.selectSparkVersion(
170+
new SparkVersionSelector().withSparkVersion("3.5.0").withLatest());
164171
// Should return the highest version (14.3.x) when latest=true and multiple 3.5.0 versions match
165172
assertEquals("14.3.x-scala2.12", sparkVersion);
166173
}
@@ -169,36 +176,41 @@ void sparkVersionWithSparkVersionParameterMultipleMatches() {
169176
void sparkVersionWithSparkVersionParameterAndML() {
170177
ClustersExt clustersExt = new ClustersExt(clustersMock);
171178
Mockito.doReturn(testGetSparkVersionsWithSparkVersion()).when(clustersMock).sparkVersions();
172-
179+
173180
// Test spark version combined with ML requirement
174-
String sparkVersion = clustersExt.selectSparkVersion(
175-
new SparkVersionSelector().withSparkVersion("3.5.0").withML());
181+
String sparkVersion =
182+
clustersExt.selectSparkVersion(
183+
new SparkVersionSelector().withSparkVersion("3.5.0").withML());
176184
assertEquals("14.2.x-cpu-ml-scala2.12", sparkVersion);
177185
}
178186

179187
@Test
180188
void sparkVersionWithSparkVersionParameterNoMatch() {
181189
ClustersExt clustersExt = new ClustersExt(clustersMock);
182190
Mockito.doReturn(testGetSparkVersionsWithSparkVersion()).when(clustersMock).sparkVersions();
183-
191+
184192
// Test spark version that doesn't exist
185-
assertThrows(IllegalArgumentException.class, () -> {
186-
clustersExt.selectSparkVersion(
187-
new SparkVersionSelector().withSparkVersion("2.4.5"));
188-
});
193+
assertThrows(
194+
IllegalArgumentException.class,
195+
() -> {
196+
clustersExt.selectSparkVersion(new SparkVersionSelector().withSparkVersion("2.4.5"));
197+
});
189198
}
190199

191200
@Test
192201
void sparkVersionWithSparkVersionParameterMultipleMatchesLatestFalse() {
193202
ClustersExt clustersExt = new ClustersExt(clustersMock);
194203
Mockito.doReturn(testGetSparkVersionsWithSparkVersion()).when(clustersMock).sparkVersions();
195-
204+
196205
// Test spark version with multiple matches and latest=false (default) - should throw exception
197206
SparkVersionSelector selector = new SparkVersionSelector().withSparkVersion("3.5.0");
198207
// latest defaults to false, so multiple matches should throw an exception
199-
200-
assertThrows(IllegalArgumentException.class, () -> {
201-
clustersExt.selectSparkVersion(selector);
202-
}, "Expected exception when multiple versions match with latest=false (default)");
208+
209+
assertThrows(
210+
IllegalArgumentException.class,
211+
() -> {
212+
clustersExt.selectSparkVersion(selector);
213+
},
214+
"Expected exception when multiple versions match with latest=false (default)");
203215
}
204216
}

0 commit comments

Comments
 (0)