File tree Expand file tree Collapse file tree 5 files changed +13
-9
lines changed
inject-test/src/test/java Expand file tree Collapse file tree 5 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 5
5
import org .example .coffee .list .ASomei ;
6
6
import org .example .coffee .list .BSomei ;
7
7
import org .example .coffee .list .Somei ;
8
+ import org .example .coffee .priority .base .ABasei ;
9
+ import org .example .coffee .priority .base .BBasei ;
10
+ import org .example .coffee .priority .base .BaseIface ;
11
+ import org .example .coffee .priority .base .CBasei ;
8
12
import org .junit .jupiter .api .Test ;
9
13
10
14
import javax .annotation .Priority ;
@@ -17,12 +21,12 @@ public class SystemContextTest {
17
21
@ Test
18
22
public void getBeansByPriority () {
19
23
20
- final List <Somei > beans = SystemContext .context (). getBeansByPriority (Somei . class , Priority .class );
24
+ final List <BaseIface > beans = SystemContext .getBeansByPriority (BaseIface .class );
21
25
assertThat (beans ).hasSize (3 );
22
26
23
- assertThat (beans .get (0 )).isInstanceOf (BSomei .class );
24
- assertThat (beans .get (1 )).isInstanceOf (ASomei .class );
25
- assertThat (beans .get (2 )).isInstanceOf (A2Somei .class );
27
+ assertThat (beans .get (0 )).isInstanceOf (CBasei .class );
28
+ assertThat (beans .get (1 )).isInstanceOf (BBasei .class );
29
+ assertThat (beans .get (2 )).isInstanceOf (ABasei .class );
26
30
}
27
31
28
32
@ Test
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public void test() {
17
17
try (BeanContext context = new BeanContextBuilder ().build ()) {
18
18
CombinedSomei bean = context .getBean (CombinedSomei .class );
19
19
List <String > somes = bean .lotsOfSomes ();
20
- assertThat (somes ).containsOnly ("a" , "b" );
20
+ assertThat (somes ).containsOnly ("a" , "b" , "a2" );
21
21
}
22
22
}
23
23
@@ -26,7 +26,7 @@ public void test_set() {
26
26
try (BeanContext context = new BeanContextBuilder ().build ()) {
27
27
CombinedSetSomei bean = context .getBean (CombinedSetSomei .class );
28
28
List <String > somes = bean .lotsOfSomes ();
29
- assertThat (somes ).containsOnly ("a" , "b" );
29
+ assertThat (somes ).containsOnly ("a" , "b" , "a2" );
30
30
}
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ public class A2Somei implements Somei {
9
9
10
10
@ Override
11
11
public String some () {
12
- return "a " ;
12
+ return "a2 " ;
13
13
}
14
14
}
Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ public class CBasei implements BaseIface {
10
10
11
11
@ Override
12
12
public String other () {
13
- return "a " ;
13
+ return "c " ;
14
14
}
15
15
}
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ public class COtheri implements OtherIface {
8
8
9
9
@ Override
10
10
public String other () {
11
- return "a " ;
11
+ return "c " ;
12
12
}
13
13
}
You can’t perform that action at this time.
0 commit comments