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 = mock (ResourceFetcher .class );
21
27
22
28
@ BeforeEach
23
29
void setup () {
@@ -28,7 +34,7 @@ void setup() {
28
34
}
29
35
30
36
@ Test
31
- void notFetchesResourceFromServer () {
37
+ void shouldNotFetchResourcesFromServerIfNotKnown () {
32
38
var res = boundedItemStore .get (testRes1Key ());
33
39
34
40
assertThat (res ).isNull ();
@@ -49,7 +55,7 @@ void getsResourceFromServerIfNotInCache() {
49
55
}
50
56
51
57
@ Test
52
- void ifFetchingNotFoundResourceRemovesItFromStore () {
58
+ void removesResourcesNotFoundOnServerFromStore () {
53
59
boundedItemStore .put (testRes1Key (),
54
60
TestUtils .testCustomResource1 ());
55
61
when (resourceFetcher .fetchResource (testRes1Key ()))
@@ -75,7 +81,7 @@ void removesResourceFromCache() {
75
81
}
76
82
77
83
@ Test
78
- void readingKeySeyNotReadsTheBoundedCache () {
84
+ void readingKeySetDoesNotReadFromBoundedCache () {
79
85
boundedItemStore .put (testRes1Key (),
80
86
TestUtils .testCustomResource1 ());
81
87
@@ -85,7 +91,7 @@ void readingKeySeyNotReadsTheBoundedCache() {
85
91
}
86
92
87
93
@ Test
88
- void readingValuesNotReadsTheBoundedCache () {
94
+ void readingValuesDoesNotReadFromBoundedCache () {
89
95
boundedItemStore .put (testRes1Key (),
90
96
TestUtils .testCustomResource1 ());
91
97
0 commit comments