-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for JService annotation
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
jackdaw-sample/src/test/kotlin/com/github/vbauer/jackdaw/JServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.github.vbauer.jackdaw | ||
|
||
import com.github.vbauer.jackdaw.bean.AbstractTypeA | ||
import com.github.vbauer.jackdaw.bean.AbstractTypeB | ||
import com.github.vbauer.jackdaw.bean.BaseType | ||
import com.google.common.collect.Lists | ||
import org.hamcrest.Matchers.hasItem | ||
import org.hamcrest.Matchers.hasSize | ||
import org.junit.Assert.assertThat | ||
import org.junit.Test | ||
import java.util.* | ||
|
||
/** | ||
* @author Vladislav Bauer | ||
*/ | ||
|
||
class JServiceTest { | ||
|
||
@Test | ||
fun testBaseType() { | ||
val loader = ServiceLoader.load(BaseType::class.java) | ||
val beans = Lists.newArrayList<BaseType>(loader) | ||
assertThat(beans, hasSize(2)) | ||
|
||
val classes = beans.map { b -> b.javaClass } | ||
assertThat(classes, hasItem(AbstractTypeA::class.java)) | ||
assertThat(classes, hasItem(AbstractTypeB::class.java)) | ||
} | ||
|
||
} |