1
1
package io .avaje .inject ;
2
2
3
3
import org .example .coffee .fruit .Fruit ;
4
+ import org .example .coffee .list .A2Somei ;
4
5
import org .example .coffee .list .ASomei ;
5
6
import org .example .coffee .list .BSomei ;
6
7
import org .example .coffee .list .Somei ;
@@ -16,28 +17,30 @@ public class SystemContextTest {
16
17
@ Test
17
18
public void getBeansByPriority () {
18
19
19
- final List <Somei > beans = SystemContext .getBeansByPriority (Somei .class );
20
- assertThat (beans ).hasSize (2 );
20
+ final List <Somei > beans = SystemContext .context (). getBeansByPriority (Somei . class , Priority .class );
21
+ assertThat (beans ).hasSize (3 );
21
22
22
23
assertThat (beans .get (0 )).isInstanceOf (BSomei .class );
23
24
assertThat (beans .get (1 )).isInstanceOf (ASomei .class );
25
+ assertThat (beans .get (2 )).isInstanceOf (A2Somei .class );
24
26
}
25
27
26
28
@ Test
27
29
public void getBeansByPriority_withAnnotation () {
28
30
29
31
final List <Somei > beans = SystemContext .context ().getBeansByPriority (Somei .class , Priority .class );
30
- assertThat (beans ).hasSize (2 );
32
+ assertThat (beans ).hasSize (3 );
31
33
32
34
assertThat (beans .get (0 )).isInstanceOf (BSomei .class );
33
35
assertThat (beans .get (1 )).isInstanceOf (ASomei .class );
36
+ assertThat (beans .get (2 )).isInstanceOf (A2Somei .class );
34
37
}
35
38
36
39
@ Test
37
40
public void getBeansUnsorted_withPriority () {
38
41
39
42
final List <Somei > beans = SystemContext .getBeans (Somei .class );
40
- assertThat (beans ).hasSize (2 );
43
+ assertThat (beans ).hasSize (3 );
41
44
// can't assert bean order
42
45
}
43
46
0 commit comments