23
23
import org .apache .flink .runtime .highavailability .HighAvailabilityServices ;
24
24
import org .apache .flink .runtime .jobmaster .KvStateLocationOracle ;
25
25
import org .apache .flink .runtime .query .KvStateLocation ;
26
- import org .apache .flink .util .TestLogger ;
27
26
28
- import org .junit .After ;
29
- import org .junit .Before ;
30
- import org .junit .Test ;
27
+ import org .junit .jupiter . api . AfterEach ;
28
+ import org .junit .jupiter . api . BeforeEach ;
29
+ import org .junit .jupiter . api . Test ;
31
30
32
31
import java .net .InetAddress ;
33
32
import java .util .Collections ;
34
33
import java .util .concurrent .CompletableFuture ;
35
34
36
- import static org .hamcrest .Matchers .equalTo ;
37
- import static org .hamcrest .Matchers .nullValue ;
38
- import static org .junit .Assert .assertThat ;
35
+ import static org .assertj .core .api .Assertions .assertThat ;
39
36
40
37
/** Tests for the {@link KvStateClientProxyImpl}. */
41
- public class KvStateClientProxyImplTest extends TestLogger {
38
+ class KvStateClientProxyImplTest {
42
39
43
40
private KvStateClientProxyImpl kvStateClientProxy ;
44
41
45
- @ Before
46
- public void setup () {
42
+ @ BeforeEach
43
+ void setup () {
47
44
kvStateClientProxy =
48
45
new KvStateClientProxyImpl (
49
46
InetAddress .getLoopbackAddress ().getHostName (),
@@ -53,14 +50,14 @@ public void setup() {
53
50
new DisabledKvStateRequestStats ());
54
51
}
55
52
56
- @ After
57
- public void shutdown () {
53
+ @ AfterEach
54
+ void shutdown () {
58
55
kvStateClientProxy .shutdown ();
59
56
}
60
57
61
58
/** Tests that we can set and retrieve the {@link KvStateLocationOracle}. */
62
59
@ Test
63
- public void testKvStateLocationOracle () {
60
+ void testKvStateLocationOracle () {
64
61
final JobID jobId1 = new JobID ();
65
62
final TestingKvStateLocationOracle kvStateLocationOracle1 =
66
63
new TestingKvStateLocationOracle ();
@@ -70,34 +67,32 @@ public void testKvStateLocationOracle() {
70
67
new TestingKvStateLocationOracle ();
71
68
kvStateClientProxy .updateKvStateLocationOracle (jobId2 , kvStateLocationOracle2 );
72
69
73
- assertThat (kvStateClientProxy .getKvStateLocationOracle (new JobID ()), nullValue () );
70
+ assertThat (kvStateClientProxy .getKvStateLocationOracle (new JobID ())). isNull ( );
74
71
75
- assertThat (
76
- kvStateClientProxy .getKvStateLocationOracle (jobId1 ),
77
- equalTo (kvStateLocationOracle1 ));
78
- assertThat (
79
- kvStateClientProxy .getKvStateLocationOracle (jobId2 ),
80
- equalTo (kvStateLocationOracle2 ));
72
+ assertThat (kvStateClientProxy .getKvStateLocationOracle (jobId1 ))
73
+ .isEqualTo (kvStateLocationOracle1 );
74
+ assertThat (kvStateClientProxy .getKvStateLocationOracle (jobId2 ))
75
+ .isEqualTo (kvStateLocationOracle2 );
81
76
82
77
kvStateClientProxy .updateKvStateLocationOracle (jobId1 , null );
83
- assertThat (kvStateClientProxy .getKvStateLocationOracle (jobId1 ), nullValue () );
78
+ assertThat (kvStateClientProxy .getKvStateLocationOracle (jobId1 )). isNull ( );
84
79
}
85
80
86
81
/**
87
82
* Tests that {@link KvStateLocationOracle} registered under {@link
88
83
* HighAvailabilityServices#DEFAULT_JOB_ID} will be used for all requests.
89
84
*/
90
85
@ Test
91
- public void testLegacyCodePathPreference () {
86
+ void testLegacyCodePathPreference () {
92
87
final TestingKvStateLocationOracle kvStateLocationOracle =
93
88
new TestingKvStateLocationOracle ();
94
89
kvStateClientProxy .updateKvStateLocationOracle (
95
90
HighAvailabilityServices .DEFAULT_JOB_ID , kvStateLocationOracle );
96
91
final JobID jobId = new JobID ();
97
92
kvStateClientProxy .updateKvStateLocationOracle (jobId , new TestingKvStateLocationOracle ());
98
93
99
- assertThat (
100
- kvStateClientProxy . getKvStateLocationOracle ( jobId ), equalTo ( kvStateLocationOracle ) );
94
+ assertThat (kvStateClientProxy . getKvStateLocationOracle ( jobId ))
95
+ . isEqualTo ( kvStateLocationOracle );
101
96
}
102
97
103
98
/** Testing implementation of {@link KvStateLocationOracle}. */
0 commit comments