Extracted TestUtils
This commit is contained in:
parent
f6a0022b24
commit
af94ff2049
|
@ -2,7 +2,7 @@ package net.codinux.invoicing.reader
|
||||||
|
|
||||||
import net.codinux.invoicing.model.Invoice
|
import net.codinux.invoicing.model.Invoice
|
||||||
import net.codinux.invoicing.test.InvoiceAsserter
|
import net.codinux.invoicing.test.InvoiceAsserter
|
||||||
import java.io.InputStream
|
import net.codinux.invoicing.test.TestUtils
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
class EInvoiceReaderTest {
|
class EInvoiceReaderTest {
|
||||||
|
@ -32,8 +32,7 @@ class EInvoiceReaderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getTestFile(filename: String): InputStream =
|
private fun getTestFile(filename: String) = TestUtils.getTestFileAsStream(filename)
|
||||||
this.javaClass.classLoader.getResourceAsStream("files/$filename")!!
|
|
||||||
|
|
||||||
private fun assertInvoice(invoice: Invoice?) {
|
private fun assertInvoice(invoice: Invoice?) {
|
||||||
InvoiceAsserter.assertInvoice(invoice)
|
InvoiceAsserter.assertInvoice(invoice)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.codinux.invoicing.test
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
|
object TestUtils {
|
||||||
|
|
||||||
|
fun getTestFileAsStream(filename: String): InputStream =
|
||||||
|
this.javaClass.classLoader.getResourceAsStream("files/$filename")!!
|
||||||
|
|
||||||
|
fun getTestFile(filename: String): File =
|
||||||
|
File(this.javaClass.classLoader.getResource("files/$filename")!!.toURI())
|
||||||
|
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ package net.codinux.invoicing.validation
|
||||||
|
|
||||||
import assertk.assertThat
|
import assertk.assertThat
|
||||||
import assertk.assertions.*
|
import assertk.assertions.*
|
||||||
import java.io.File
|
import net.codinux.invoicing.test.TestUtils
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
class EInvoiceValidatorTest {
|
class EInvoiceValidatorTest {
|
||||||
|
@ -54,7 +54,6 @@ class EInvoiceValidatorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getTestFile(filename: String): File =
|
private fun getTestFile(filename: String) = TestUtils.getTestFile(filename)
|
||||||
File(this.javaClass.classLoader.getResource("files/$filename")!!.toURI())
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue