package io.gitlab.arturbosch.detekt.test

import java.net.URI
import java.nio.file.Files
import java.nio.file.Paths

internal object Resources

fun resource(name: String): URI {
	val explicitName = if (name.startsWith("/")) name else "/$name"
	val resource = Resources::class.java.getResource(explicitName)
	requireNotNull(resource) { "Make sure the resource '$name' exists!" }
	return resource.toURI()
}

fun resourcePath(name: String): String = resource(name).path

fun resourceAsString(name: String): String = String(Files.readAllBytes(Paths.get(resourcePath(name))))
package io.gitlab.arturbosch.detekt.test

import java.net.URI
import java.nio.file.Files
import java.nio.file.Paths

internal object Resources

fun resource(name: String): URI {
	val explicitName = if (name.startsWith("/")) name else "/$name"
	val resource = Resources::class.java.getResource(explicitName)
	requireNotNull(resource) { "Make sure the resource '$name' exists!" }
	return resource.toURI()
}

fun resourceAsString(name: String): String = String(Files.readAllBytes(Paths.get(resource(name))))
Use uri instead of converting it to a string in paths
Use uri instead of converting it to a string in paths

Mauin/detekt,MyDogTom/detekt,rock3r/detekt,arturbosch/detekt,Mauin/detekt,arturbosch/detekt,Mauin/detekt,arturbosch/detekt,Mauin/detekt,rock3r/detekt,rock3r/detekt