mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-11-30 02:57:37 +08:00
[Core] [Convert] [XML] Add module test
This commit is contained in:
parent
1203f2d68e
commit
94a97378b0
@ -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
|
||||
|
@ -6,6 +6,6 @@ abstract class ConvertModule : AbstractModule()
|
||||
{
|
||||
fun name(): String = this.javaClass
|
||||
.simpleName
|
||||
.removeSuffix("File")
|
||||
.removeSuffix("Convert")
|
||||
.removeSuffix("Module")
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user