File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
core/src/test/kotlin/com/tschuchort/compiletesting Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ package com.tschuchort.compiletesting
2+
3+ import junit.framework.TestCase.assertEquals
4+ import org.junit.Test
5+
6+ class EncodingUtilsTest {
7+ @Test
8+ fun encodePath_returnsSamePath_whenPathAlreadyValidEncoded () {
9+ // Given: A valid path
10+ val path = " file://users/johndoe/.gradle/something/somewhere/kotlin-compiler.jar"
11+
12+ // When: Path is encoded
13+ val actualPath = encodePath(path)
14+
15+ // Then: The same path should be returned
16+ assertEquals(path, actualPath)
17+ }
18+
19+ @Test
20+ fun encodePath_returnsEncodedPath_whenPathIsNotAlreadyValidEncoded () {
21+ // Given: A path having whitespace in it
22+ val path = " file://users/john doe/.gradle/something/somewhere/kotlin-compiler.jar"
23+
24+ // When: Path is encoded
25+ val actualPath = encodePath(path)
26+
27+ // Then: The valid encoded path should be returned
28+ val expectedPath = " file://users/john%20doe/.gradle/something/somewhere/kotlin-compiler.jar"
29+ assertEquals(expectedPath, actualPath)
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments