Skip to content

Commit 3b7520c

Browse files
committed
Remove Google Truth dependency
1 parent 50656cb commit 3b7520c

16 files changed

Lines changed: 518 additions & 498 deletions

core/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ dependencies {
4242
api(libs.kotlin.compilerEmbeddable)
4343
implementation(libs.ec4j)
4444
testImplementation(platform(libs.junit.bom))
45-
testImplementation(libs.googleTruth) {
46-
exclude(group = "junit", module = "junit")
47-
}
4845
testImplementation(libs.junit.jupiter)
4946
testRuntimeOnly(libs.junit.platform.launcher)
5047
}

core/src/test/java/com/facebook/ktfmt/cli/EditorConfigResolverTest.kt

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package com.facebook.ktfmt.cli
1919
import com.facebook.ktfmt.format.Formatter
2020
import com.facebook.ktfmt.format.TrailingCommaManagementStrategy
2121
import com.facebook.ktfmt.format.TrailingCommaManagementStrategy.ONLY_ADD
22-
import com.google.common.truth.Truth.assertThat
2322
import java.nio.charset.Charset
2423
import java.nio.charset.StandardCharsets
2524
import kotlin.io.path.createTempDirectory
2625
import kotlin.text.Charsets.UTF_8
2726
import org.junit.jupiter.api.AfterEach
27+
import org.junit.jupiter.api.Assertions.assertEquals
2828
import org.junit.jupiter.api.BeforeEach
2929
import org.junit.jupiter.api.Test
3030

@@ -35,7 +35,7 @@ class EditorConfigResolverTest {
3535

3636
@BeforeEach
3737
fun setUp() {
38-
assertThat(Charset.defaultCharset()).isEqualTo(testCharset) // Verify the test JVM flags
38+
assertEquals(testCharset, Charset.defaultCharset()) // Verify the test JVM flags
3939
}
4040

4141
@AfterEach
@@ -49,7 +49,7 @@ class EditorConfigResolverTest {
4949
src.parentFile.mkdirs()
5050
src.writeText("", UTF_8)
5151
val resolved = EditorConfigResolver.resolveFormattingOptions(src, Formatter.GOOGLE_FORMAT)
52-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT)
52+
assertEquals(Formatter.GOOGLE_FORMAT, resolved)
5353
}
5454

5555
@Test
@@ -66,7 +66,7 @@ class EditorConfigResolverTest {
6666

6767
val file = root.resolve("src/main/kotlin/Example.kt")
6868
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
69-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT)
69+
assertEquals(Formatter.GOOGLE_FORMAT, resolved)
7070
}
7171

7272
@Test
@@ -83,7 +83,7 @@ class EditorConfigResolverTest {
8383

8484
val file = root.resolve("src/main/kotlin/Example.kt")
8585
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
86-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(maxWidth = 80))
86+
assertEquals(Formatter.GOOGLE_FORMAT.copy(maxWidth = 80), resolved)
8787
}
8888

8989
@Test
@@ -100,7 +100,7 @@ class EditorConfigResolverTest {
100100

101101
val file = root.resolve("src/main/kotlin/Example.kt")
102102
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
103-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT)
103+
assertEquals(Formatter.GOOGLE_FORMAT, resolved)
104104
}
105105

106106
@Test
@@ -117,7 +117,7 @@ class EditorConfigResolverTest {
117117

118118
val file = root.resolve("src/main/kotlin/Example.kt")
119119
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
120-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3))
120+
assertEquals(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3), resolved)
121121
}
122122

123123
@Test
@@ -134,7 +134,7 @@ class EditorConfigResolverTest {
134134

135135
val file = root.resolve("src/main/kotlin/Example.kt")
136136
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
137-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT)
137+
assertEquals(Formatter.GOOGLE_FORMAT, resolved)
138138
}
139139

140140
@Test
@@ -152,7 +152,7 @@ class EditorConfigResolverTest {
152152

153153
val file = root.resolve("src/main/kotlin/Example.kt")
154154
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
155-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(blockIndent = 8))
155+
assertEquals(Formatter.GOOGLE_FORMAT.copy(blockIndent = 8), resolved)
156156
}
157157

158158
@Test
@@ -169,7 +169,7 @@ class EditorConfigResolverTest {
169169

170170
val file = root.resolve("src/main/kotlin/Example.kt")
171171
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
172-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3))
172+
assertEquals(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3), resolved)
173173
}
174174

175175
@Test
@@ -187,7 +187,7 @@ class EditorConfigResolverTest {
187187

188188
val file = root.resolve("src/main/kotlin/Example.kt")
189189
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
190-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3))
190+
assertEquals(Formatter.GOOGLE_FORMAT.copy(blockIndent = 3), resolved)
191191
}
192192

193193
@Test
@@ -204,7 +204,7 @@ class EditorConfigResolverTest {
204204

205205
val file = root.resolve("src/main/kotlin/Example.kt")
206206
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
207-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3))
207+
assertEquals(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3), resolved)
208208
}
209209

210210
@Test
@@ -221,7 +221,7 @@ class EditorConfigResolverTest {
221221

222222
val file = root.resolve("src/main/kotlin/Example.kt")
223223
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
224-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3))
224+
assertEquals(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3), resolved)
225225
}
226226

227227
@Test
@@ -239,7 +239,7 @@ class EditorConfigResolverTest {
239239

240240
val file = root.resolve("src/main/kotlin/Example.kt")
241241
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
242-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3))
242+
assertEquals(Formatter.GOOGLE_FORMAT.copy(continuationIndent = 3), resolved)
243243
}
244244

245245
@Test
@@ -256,8 +256,7 @@ class EditorConfigResolverTest {
256256

257257
val file = root.resolve("src/main/kotlin/Example.kt")
258258
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
259-
assertThat(resolved)
260-
.isEqualTo(Formatter.GOOGLE_FORMAT.copy(trailingCommaManagementStrategy = ONLY_ADD))
259+
assertEquals(Formatter.GOOGLE_FORMAT.copy(trailingCommaManagementStrategy = ONLY_ADD), resolved)
261260
}
262261

263262
@Test
@@ -274,7 +273,7 @@ class EditorConfigResolverTest {
274273

275274
val file = root.resolve("src/main/kotlin/Example.kt")
276275
val resolved = EditorConfigResolver.resolveFormattingOptions(file, Formatter.GOOGLE_FORMAT)
277-
assertThat(resolved).isEqualTo(Formatter.GOOGLE_FORMAT)
276+
assertEquals(Formatter.GOOGLE_FORMAT, resolved)
278277
}
279278

280279
@Test
@@ -337,23 +336,33 @@ class EditorConfigResolverTest {
337336
)
338337

339338
val fileInRoot = root.resolve("build.gradle.kts")
340-
assertThat(EditorConfigResolver.resolveFormattingOptions(fileInRoot, Formatter.GOOGLE_FORMAT))
341-
.isEqualTo(rootOptions)
339+
assertEquals(
340+
rootOptions,
341+
EditorConfigResolver.resolveFormattingOptions(fileInRoot, Formatter.GOOGLE_FORMAT),
342+
)
342343

343344
val fileInMain = root.resolve("src/main/kotlin/Example.kt")
344-
assertThat(EditorConfigResolver.resolveFormattingOptions(fileInMain, Formatter.GOOGLE_FORMAT))
345-
.isEqualTo(mainOptions)
345+
assertEquals(
346+
mainOptions,
347+
EditorConfigResolver.resolveFormattingOptions(fileInMain, Formatter.GOOGLE_FORMAT),
348+
)
346349

347350
val fileInTest = root.resolve("src/test/kotlin/ExampleTest.kt")
348-
assertThat(EditorConfigResolver.resolveFormattingOptions(fileInTest, Formatter.GOOGLE_FORMAT))
349-
.isEqualTo(testOptions)
351+
assertEquals(
352+
testOptions,
353+
EditorConfigResolver.resolveFormattingOptions(fileInTest, Formatter.GOOGLE_FORMAT),
354+
)
350355

351356
val ktsInMain = root.resolve("src/main/kotlin/ExampleTest.kts")
352-
assertThat(EditorConfigResolver.resolveFormattingOptions(ktsInMain, Formatter.GOOGLE_FORMAT))
353-
.isEqualTo(rootOptions.copy(maxWidth = 120))
357+
assertEquals(
358+
rootOptions.copy(maxWidth = 120),
359+
EditorConfigResolver.resolveFormattingOptions(ktsInMain, Formatter.GOOGLE_FORMAT),
360+
)
354361

355362
val ktsInTest = root.resolve("src/test/kotlin/ExampleTest.kts")
356-
assertThat(EditorConfigResolver.resolveFormattingOptions(ktsInTest, Formatter.GOOGLE_FORMAT))
357-
.isEqualTo(Formatter.GOOGLE_FORMAT) // root=true stops even non-matching fall-through
363+
assertEquals(
364+
Formatter.GOOGLE_FORMAT,
365+
EditorConfigResolver.resolveFormattingOptions(ktsInTest, Formatter.GOOGLE_FORMAT),
366+
) // root=true stops even non-matching fall-through
358367
}
359368
}

0 commit comments

Comments
 (0)