[Core] [Convert] [XML] Add module test

This commit is contained in:
qianmoQ 2024-07-02 10:45:18 +08:00
parent 1203f2d68e
commit 94a97378b0
3 changed files with 30 additions and 3 deletions

View File

@ -9,12 +9,12 @@ interface Convert
{
return this.javaClass
.simpleName
.removeSuffix("File")
.removeSuffix("Convert")
}
fun description(): String
{
return "Integrate ${name()} file"
return "Integrate ${name()} format convert"
}
fun format(request: ConvertRequest): ConvertResponse

View File

@ -6,6 +6,6 @@ abstract class ConvertModule : AbstractModule()
{
fun name(): String = this.javaClass
.simpleName
.removeSuffix("File")
.removeSuffix("Convert")
.removeSuffix("Module")
}

View File

@ -0,0 +1,27 @@
package io.edurt.datacap.convert.xml
import com.google.inject.Guice.createInjector
import com.google.inject.Injector
import com.google.inject.Key
import com.google.inject.TypeLiteral
import io.edurt.datacap.convert.Convert
import io.edurt.datacap.convert.ConvertManager
import org.junit.Assert.assertEquals
import org.junit.Test
class XmlModuleTest
{
private val injector: Injector = createInjector(ConvertManager())
@Test
fun test()
{
injector.getInstance(Key.get(object : TypeLiteral<Set<Convert>>()
{}))
.stream()
.findFirst()
.ifPresent {
assertEquals("Xml", it.name())
}
}
}