forked from Alluxio/alluxio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Alluxio#2752 from alexnaspo/ALLUXIO-1588
[ALLUXIO-1588] Add test coverage for WorkerClientHeartbeatExecutor
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...t-internal/src/test/java/alluxio/client/block/BlockWorkerClientHeartbeatExecutorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0 | ||
* (the “License”). You may not use this work except in compliance with the License, which is | ||
* available at www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied, as more fully set forth in the License. | ||
* | ||
* See the NOTICE file distributed with this work for information regarding copyright ownership. | ||
*/ | ||
|
||
package alluxio.client.block; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mockito; | ||
import org.powermock.api.mockito.PowerMockito; | ||
import org.powermock.modules.junit4.PowerMockRunner; | ||
import org.powermock.core.classloader.annotations.PrepareForTest; | ||
|
||
/** | ||
* Tests for the {@link BlockWorkerClientHeartbeatExecutor} class. | ||
*/ | ||
@RunWith(PowerMockRunner.class) | ||
@PrepareForTest(BlockWorkerClient.class) | ||
public class BlockWorkerClientHeartbeatExecutorTest { | ||
|
||
/** | ||
* Tests to ensure heartbeat calls BlockWorkerClient.periodicHeartbeat. | ||
* | ||
* @throws Exception when the periodicHeartbeat is not called once | ||
*/ | ||
@Test | ||
public void heartbeatCallsPeriodicHeartbeat() throws Exception { | ||
BlockWorkerClient mock = PowerMockito.mock(BlockWorkerClient.class); | ||
BlockWorkerClientHeartbeatExecutor heartbeatExecutor = | ||
new BlockWorkerClientHeartbeatExecutor(mock); | ||
|
||
heartbeatExecutor.heartbeat(); | ||
|
||
Mockito.verify(mock).periodicHeartbeat(); | ||
} | ||
} |