forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.4 KiB
45 lines
1.4 KiB
5 years ago
|
package com.fanruan.api.cluster.state;
|
||
|
|
||
|
import com.fr.cluster.engine.core.jchannel.MachineMarker;
|
||
|
import org.easymock.EasyMock;
|
||
|
import org.junit.Assert;
|
||
|
import org.junit.Before;
|
||
|
import org.junit.Test;
|
||
|
import org.junit.runner.RunWith;
|
||
|
import org.powermock.api.easymock.PowerMock;
|
||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||
|
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
|
||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||
|
|
||
|
/**
|
||
|
* @author Lucian.Chen
|
||
|
* @version 10.0
|
||
|
* Created by Lucian.Chen on 2020/3/24
|
||
|
*/
|
||
|
@RunWith(PowerMockRunner.class)
|
||
|
@PrepareForTest(MachineMarker.class)
|
||
|
@SuppressStaticInitializationFor("com.fr.cluster.engine.core.jchannel.MachineMarker")
|
||
|
public class MachineKitTest {
|
||
|
|
||
|
@Test
|
||
|
public void testCurrentID() {
|
||
|
|
||
|
PowerMock.mockStatic(MachineMarker.class);
|
||
|
EasyMock.expect(MachineMarker.currentID()).andReturn("1").anyTimes();
|
||
|
|
||
|
PowerMock.replay(MachineMarker.class);
|
||
|
Assert.assertEquals(MachineKit.currentID(), "1");
|
||
|
PowerMock.verify(MachineMarker.class);
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
public void testCurrentName() {
|
||
|
PowerMock.mockStatic(MachineMarker.class);
|
||
|
EasyMock.expect(MachineMarker.currentName()).andReturn("1").anyTimes();
|
||
|
|
||
|
PowerMock.replay(MachineMarker.class);
|
||
|
Assert.assertEquals(MachineKit.currentName(), "1");
|
||
|
PowerMock.verify(MachineMarker.class);
|
||
|
}
|
||
|
}
|