Rename root to ROOT

Path is immutable.

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 4 years ago
parent 0afc7a563d
commit 89accc8b26
  1. 10
      cache/src/test/java/dev/openrs2/cache/DiskStoreTest.kt
  2. 10
      cache/src/test/java/dev/openrs2/cache/FlatFileStoreTest.kt

@ -15,7 +15,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue import kotlin.test.assertTrue
object DiskStoreTest { object DiskStoreTest {
private val root = Paths.get(DiskStoreTest::class.java.getResource("disk-store").toURI()) private val ROOT = Paths.get(DiskStoreTest::class.java.getResource("disk-store").toURI())
@Test @Test
fun testBounds() { fun testBounds() {
@ -727,7 +727,7 @@ object DiskStoreTest {
} }
private fun readTest(name: String, f: (Store) -> Unit) { private fun readTest(name: String, f: (Store) -> Unit) {
DiskStore.open(root.resolve(name)).use { store -> DiskStore.open(ROOT.resolve(name)).use { store ->
f(store) f(store)
} }
} }
@ -739,7 +739,7 @@ object DiskStoreTest {
f(store) f(store)
} }
val expected = root.resolve(name) val expected = ROOT.resolve(name)
assertTrue(expected.recursiveEquals(actual)) assertTrue(expected.recursiveEquals(actual))
} }
} }
@ -747,13 +747,13 @@ object DiskStoreTest {
private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.unix()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.getPath("/cache")
root.resolve(src).recursiveCopy(actual) ROOT.resolve(src).recursiveCopy(actual)
DiskStore.open(actual).use { store -> DiskStore.open(actual).use { store ->
f(store) f(store)
} }
val expected = root.resolve(name) val expected = ROOT.resolve(name)
assertTrue(expected.recursiveEquals(actual)) assertTrue(expected.recursiveEquals(actual))
} }
} }

@ -17,7 +17,7 @@ import kotlin.test.assertTrue
object FlatFileStoreTest { object FlatFileStoreTest {
private val IGNORE_GIT_EMPTY = { path: Path -> path.fileName.toString() != ".gitempty" } private val IGNORE_GIT_EMPTY = { path: Path -> path.fileName.toString() != ".gitempty" }
private val root = Paths.get(FlatFileStoreTest::class.java.getResource("flat-file-store").toURI()) private val ROOT = Paths.get(FlatFileStoreTest::class.java.getResource("flat-file-store").toURI())
@Test @Test
fun testBounds() { fun testBounds() {
@ -243,7 +243,7 @@ object FlatFileStoreTest {
} }
private fun readTest(name: String, f: (Store) -> Unit) { private fun readTest(name: String, f: (Store) -> Unit) {
FlatFileStore.open(root.resolve(name)).use { store -> FlatFileStore.open(ROOT.resolve(name)).use { store ->
f(store) f(store)
} }
} }
@ -255,7 +255,7 @@ object FlatFileStoreTest {
f(store) f(store)
} }
val expected = root.resolve(name) val expected = ROOT.resolve(name)
assertTrue(expected.recursiveEquals(actual, filter = IGNORE_GIT_EMPTY)) assertTrue(expected.recursiveEquals(actual, filter = IGNORE_GIT_EMPTY))
} }
} }
@ -263,13 +263,13 @@ object FlatFileStoreTest {
private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) { private fun overwriteTest(src: String, name: String, f: (Store) -> Unit) {
Jimfs.newFileSystem(Configuration.unix()).use { fs -> Jimfs.newFileSystem(Configuration.unix()).use { fs ->
val actual = fs.getPath("/cache") val actual = fs.getPath("/cache")
root.resolve(src).recursiveCopy(actual) ROOT.resolve(src).recursiveCopy(actual)
FlatFileStore.open(actual).use { store -> FlatFileStore.open(actual).use { store ->
f(store) f(store)
} }
val expected = root.resolve(name) val expected = ROOT.resolve(name)
assertTrue(expected.recursiveEquals(actual, filter = IGNORE_GIT_EMPTY)) assertTrue(expected.recursiveEquals(actual, filter = IGNORE_GIT_EMPTY))
} }
} }

Loading…
Cancel
Save