Skip to content

Commit 87cb177

Browse files
committed
Enhance ObfuscationServiceTest with additional assertions: add a check to ensure that obfuscated bytes differ from the original bytes, improving test coverage and validation of obfuscation functionality.
1 parent 0b6ceb9 commit 87cb177

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Benchmark Results (2026-03-19)
2+
3+
Executed with:
4+
5+
- `./gradlew :benchmark:jmh`
6+
- JDK: Corretto 17.0.9
7+
- JMH: 1.36
8+
- Mode: `avgt` (`ms/op`)
9+
- Warmup: 2 iterations
10+
- Measurement: 5 iterations
11+
12+
Results (`benchmark/build/results/jmh/results.json`):
13+
14+
| Benchmark | Param | Score (ms/op) | Error |
15+
| --- | --- | ---: | ---: |
16+
| `EndToEndBenchmark.obfuscateAndRevealBatch` | `sampleSize=100` | 0.008 | +/- 0.001 |
17+
| `EndToEndBenchmark.obfuscateAndRevealBatch` | `sampleSize=1000` | 0.096 | +/- 0.001 |
18+
| `FileScanningBenchmark.locateAssets` | `totalFiles=100` | 3.152 | +/- 0.061 |
19+
| `FileScanningBenchmark.locateAssets` | `totalFiles=1000` | 31.824 | +/- 0.680 |
20+
| `FileScanningBenchmark.locateAssets` | `totalFiles=10000` | 382.744 | +/- 15.108 |
21+
| `FileScanningBenchmark.locateResources` | `totalFiles=100` | 3.229 | +/- 0.266 |
22+
| `FileScanningBenchmark.locateResources` | `totalFiles=1000` | 32.351 | +/- 0.571 |
23+
| `FileScanningBenchmark.locateResources` | `totalFiles=10000` | 359.427 | +/- 16.350 |
24+
| `XmlParsingBenchmark.parseStringsXml` | `stringCount=10` | 0.039 | +/- 0.001 |
25+
| `XmlParsingBenchmark.parseStringsXml` | `stringCount=100` | 0.061 | +/- 0.002 |
26+
| `XmlParsingBenchmark.parseStringsXml` | `stringCount=1000` | 0.279 | +/- 0.028 |
27+
28+
Notes:
29+
30+
- This is the first benchmark snapshot in this repo layout.
31+
- A historical baseline from pre-refactor code is not available in this run, so this file serves as baseline for future regressions.

plugin/src/test/kotlin/dev/vyp/stringcare/plugin/infrastructure/crypto/ObfuscationServiceTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dev.vyp.stringcare.plugin.infrastructure.crypto
33
import dev.vyp.stringcare.plugin.internal.Stark
44
import dev.vyp.stringcare.plugin.internal.LoadResult
55
import org.junit.jupiter.api.Assertions.assertArrayEquals
6+
import org.junit.jupiter.api.Assertions.assertFalse
67
import org.junit.jupiter.api.Assertions.assertTrue
78
import org.junit.jupiter.api.Assumptions.assumeTrue
89
import org.junit.jupiter.api.Test
@@ -17,6 +18,7 @@ class ObfuscationServiceTest {
1718
val appId = "com.example.app"
1819
val obf = svc.obfuscate(key, plain, appId)
1920
assertTrue(obf.isNotEmpty())
21+
assertFalse(obf.contentEquals(plain), "Obfuscated bytes must differ from original bytes")
2022
val back = svc.reveal(key, obf, appId)
2123
assertArrayEquals(plain, back)
2224
}

0 commit comments

Comments
 (0)