Skip to content

Commit

Permalink
Add unit test for JService annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauer committed Apr 22, 2016
1 parent eb0d8b9 commit f926253
Showing 1 changed file with 30 additions and 0 deletions.
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))
}

}

0 comments on commit f926253

Please sign in to comment.