Skip to content

Commit

Permalink
test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail committed Oct 5, 2022
1 parent 79e92e6 commit ae28014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ class JConfigBuilder {
} else if (!File(directoryPath, filename).exists()) {
throw JConfigException("File does not exist!")
}

if (!filename.endsWith(extension)) {
throw JConfigException("JConfig only supports JSON files!")
}

// need to check if path ends with / if not add it

if (!directoryPath.endsWith("/")) {
directoryPath += "/"
}

val json = File(directoryPath + filename)
return try {
val root = mapper.readTree(json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import kotlin.test.assertNotNull
import org.junit.jupiter.api.Test

class JsonTest {
private val jConfig = JConfig.builder().setDirectoryPath(File("src/test/resources")).build()
private val jConfig =
JConfig.builder().setFilename("test").setDirectoryPath(File("src/test/resources")).build()

@Test
fun test() {
Expand Down

0 comments on commit ae28014

Please sign in to comment.