11
11
import static io .javaoperatorsdk .operator .processing .event .source .cache .BoundedItemStore .namespaceKeyFunc ;
12
12
import static org .assertj .core .api .Assertions .assertThat ;
13
13
import static org .mockito .ArgumentMatchers .any ;
14
- import static org .mockito .Mockito .*;
14
+ import static org .mockito .Mockito .mock ;
15
+ import static org .mockito .Mockito .never ;
16
+ import static org .mockito .Mockito .times ;
17
+ import static org .mockito .Mockito .verify ;
18
+ import static org .mockito .Mockito .when ;
15
19
16
20
class BoundedItemStoreTest {
17
21
18
22
private BoundedItemStore <TestCustomResource > boundedItemStore ;
19
- private BoundedCache <String , TestCustomResource > boundedCache = mock (BoundedCache .class );
20
- private ResourceFetcher <String , TestCustomResource > resourceFetcher = mock (ResourceFetcher .class );
23
+ @ SuppressWarnings ("unchecked" )
24
+ private final BoundedCache <String , TestCustomResource > boundedCache = mock (BoundedCache .class );
25
+ @ SuppressWarnings ("unchecked" )
26
+ private final ResourceFetcher <String , TestCustomResource > resourceFetcher =
27
+ mock (ResourceFetcher .class );
21
28
22
29
@ BeforeEach
23
30
void setup () {
@@ -28,7 +35,7 @@ void setup() {
28
35
}
29
36
30
37
@ Test
31
- void notFetchesResourceFromServer () {
38
+ void shouldNotFetchResourcesFromServerIfNotKnown () {
32
39
var res = boundedItemStore .get (testRes1Key ());
33
40
34
41
assertThat (res ).isNull ();
@@ -49,7 +56,7 @@ void getsResourceFromServerIfNotInCache() {
49
56
}
50
57
51
58
@ Test
52
- void ifFetchingNotFoundResourceRemovesItFromStore () {
59
+ void removesResourcesNotFoundOnServerFromStore () {
53
60
boundedItemStore .put (testRes1Key (),
54
61
TestUtils .testCustomResource1 ());
55
62
when (resourceFetcher .fetchResource (testRes1Key ()))
@@ -75,7 +82,7 @@ void removesResourceFromCache() {
75
82
}
76
83
77
84
@ Test
78
- void readingKeySeyNotReadsTheBoundedCache () {
85
+ void readingKeySetDoesNotReadFromBoundedCache () {
79
86
boundedItemStore .put (testRes1Key (),
80
87
TestUtils .testCustomResource1 ());
81
88
@@ -85,7 +92,7 @@ void readingKeySeyNotReadsTheBoundedCache() {
85
92
}
86
93
87
94
@ Test
88
- void readingValuesNotReadsTheBoundedCache () {
95
+ void readingValuesDoesNotReadFromBoundedCache () {
89
96
boundedItemStore .put (testRes1Key (),
90
97
TestUtils .testCustomResource1 ());
91
98
0 commit comments