Skip to content

Commit a7da771

Browse files
committed
Merge branch 'main' into renovate/protobuf
# Conflicts: # gradle/libs.versions.toml
2 parents c63bb11 + 54d02f1 commit a7da771

File tree

5 files changed

+89
-17
lines changed

5 files changed

+89
-17
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222

2323
### Metrics
2424
```text
25-
14882 number of properties
26-
10261 number of functions
27-
8796 number of classes
28-
226 number of packages
29-
3460 number of kt files
25+
14883 number of properties
26+
10262 number of functions
27+
8797 number of classes
28+
227 number of packages
29+
3461 number of kt files
3030
```
3131

3232

3333
### Complexity Report
3434
```text
35-
257825 lines of code (loc)
36-
157796 source lines of code (sloc)
37-
115146 logical lines of code (lloc)
35+
257847 lines of code (loc)
36+
157813 source lines of code (sloc)
37+
115157 logical lines of code (lloc)
3838
72253 comment lines of code (cloc)
39-
24538 cyclomatic complexity (mcc)
39+
24539 cyclomatic complexity (mcc)
4040
20171 cognitive complexity
4141
0 number of total code smells
4242
45 comment source ratio

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ dependencies {
330330
implementation("org.openjdk.jol:jol-core:0.17")
331331
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
332332
implementation(jsoup)
333-
implementation("com.google.protobuf:protobuf-java:3.19.1")
334-
implementation("com.google.protobuf:protobuf-kotlin-lite:3.19.6")
335-
implementation("io.grpc:grpc-stub:1.15.1")
336-
implementation("io.grpc:grpc-protobuf:1.15.1")
333+
implementation("com.google.protobuf:protobuf-java:4.30.0")
334+
implementation("com.google.protobuf:protobuf-kotlin-lite:4.30.0")
335+
implementation("io.grpc:grpc-stub:1.71.0")
336+
implementation("io.grpc:grpc-protobuf:1.71.0")
337337

338338

339339
testImplementation(mockk)

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependency = "1.33.0" # https://github.com/autonomousapps/dependency-analy
99
pitest = "1.15.0" # https://plugins.gradle.org/plugin/info.solidsoft.pitest
1010
ktlint = "12.2.0" # https://github.com/JLLeitschuh/ktlint-gradle
1111
kapt = "2.1.0" # https://kotlinlang.org/docs/kapt.html
12-
slf4j = "1.7.36" # https://www.slf4j.org TODO remove
12+
slf4j = "2.0.17" # https://www.slf4j.org TODO remove
1313
rxjava = "3.1.10" # https://github.com/ReactiveX/RxJava TODO remove
1414
rxkotlin = "3.0.1" # https://github.com/ReactiveX/RxKotlin TODO remove
1515
lincheck = "2.36" # https://github.com/JetBrains/lincheck
@@ -21,19 +21,19 @@ jmh = "1.37" # https://github.com/openjdk/jmh
2121
kotlintest = "3.4.2" # https://mvnrepository.com/artifact/io.kotlintest/kotlintest-core
2222
kotest = "5.9.1" # https://kotest.io
2323
assertj = "3.27.3" # https://mvnrepository.com/artifact/org.assertj/assertj-core | https://assertj.github.io/doc
24-
mockito = "5.15.2" # https://mvnrepository.com/artifact/org.mockito/mockito-core
24+
mockito = "5.16.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core
2525
mockito_kotlin = "5.4.0" # https://github.com/mockito/mockito-kotlin
2626
logback = "1.5.17" # https://logback.qos.ch
2727
hamcrest = "3.0" # https://hamcrest.org/JavaHamcrest/distributables
28-
mockk = "1.13.16" # https://mockk.io
28+
mockk = "1.13.17" # https://mockk.io
2929
kover = "0.9.1" # https://github.com/Kotlin/kotlinx-kover
3030
diktat = "2.0.0" # https://github.com/saveourtool/diktat
3131
jsoup = "1.19.1" # https://jsoup.org/
3232
turbine = "1.2.0" # https://github.com/cashapp/turbine/releases
3333
truth = "1.4.4" # https://central.sonatype.com/artifact/com.google.truth/truth/overview
3434
sandwich = "2.1.0" # https://github.com/skydoves/sandwich
3535
protobuf = "0.9.4"
36-
protoc = "3.19.1"
36+
protoc = "4.30.0"
3737

3838
[libraries]
3939
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "coroutines" }
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Kotlin Testing Frameworks
2+
3+
## ✅ Unit Testing & JVM Testing
4+
### 1. JUnit 5 (Jupiter) - Standard JVM Testing
5+
- Best for unit and integration tests.
6+
- Supports annotations like `@Test`, `@BeforeEach`, `@AfterEach`.
7+
- Works well with Kotest, Mockito, and Spring.
8+
9+
### 2. Kotest (formerly KotlinTest) - Kotlin-native Testing
10+
- Supports property-based testing, matchers, and coroutines.
11+
- DSL-style syntax for expressive tests.
12+
13+
### 3. Spek - Specification-based Testing
14+
Inspired by RSpec (from Ruby).
15+
16+
## ✅ Mocking Libraries
17+
### 4. Mockito & MockK - Mocking Frameworks
18+
- Mockito: Java-based, integrates with JUnit 5.
19+
- MockK: Kotlin-native, better for coroutines and DSL-friendly.
20+
21+
## ✅ Android UI & Instrumentation Testing
22+
### 5. Espresso - UI Testing for Android
23+
24+
### 6. UIAutomator - System UI Testing
25+
Used for interactions beyond the app (e.g., system UI, notifications).
26+
### 7. Compose Testing - Jetpack Compose UI Testing
27+
28+
## ✅ Benchmarking & Performance Testing
29+
### 8. JMH (Java Microbenchmark Harness) - Benchmark Kotlin Code
30+
Best for measuring performance of functions and loops.
31+
Requires annotation processing (kapt).
32+
33+
### 9. Android Benchmark (Jetpack)
34+
Measures Android performance in native/kotlin code.
35+
Supports BenchmarkRule and Perfetto.
36+
37+
## ✅Turbine
38+
Works with kotlinx.coroutines.Flow for testing emissions.
39+
Eliminates the need for complex collect() calls in tests.
40+
Supports structured assertions like awaitItem(), expectNoEvents(), and awaitComplete().
41+
42+
### ✅ Turbine vs Standard Flow Testing
43+
44+
| Feature | Standard Flow (`collect`) | Turbine |
45+
|----------------------------------|-----------------|---------|
46+
| Requires manual `collect()` | ✅ Yes | ❌ No |
47+
| Assertions are simple | ❌ No | ✅ Yes |
48+
| Supports awaiting specific items | ❌ No | ✅ Yes (`awaitItem()`) |
49+
| Checks for no events | ❌ No | ✅ Yes (`expectNoEvents()`) |
50+
| Supports Flow cancellation | ❌ No | ✅ Yes (`cancelAndIgnoreRemainingEvents()`) |
51+
| Handles delays in Flows | ❌ No | ✅ Yes |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package dev.shtanko.proto
2+
3+
import SearchRequestOuterClass.SearchRequest
4+
import org.junit.jupiter.api.Assertions.assertEquals
5+
import org.junit.jupiter.api.Test
6+
7+
class SearchRequestTest {
8+
9+
@Test
10+
fun testSearchRequest() {
11+
val searchRequest = SearchRequest.newBuilder()
12+
.setQuery("example query")
13+
.setPageNumber(1)
14+
.setResultPerPage(10)
15+
.build()
16+
17+
assertEquals("example query", searchRequest.query)
18+
assertEquals(1, searchRequest.pageNumber)
19+
assertEquals(10, searchRequest.resultPerPage)
20+
}
21+
}

0 commit comments

Comments
 (0)