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.
30 lines
1.1 KiB
30 lines
1.1 KiB
package com.fr.start; |
|
|
|
import junit.framework.TestCase; |
|
import org.easymock.EasyMock; |
|
import org.junit.Assert; |
|
import org.junit.runner.RunWith; |
|
import org.powermock.api.easymock.PowerMock; |
|
import org.powermock.core.classloader.annotations.PrepareForTest; |
|
import org.powermock.modules.junit4.PowerMockRunner; |
|
|
|
|
|
/** |
|
* @author hades |
|
* @version 10.0 |
|
* Created by hades on 2020/3/10 |
|
*/ |
|
@RunWith(PowerMockRunner.class) |
|
@PrepareForTest({DesignerJavaRuntime.class}) |
|
public class DesignerJavaRuntimeTest extends TestCase { |
|
|
|
public void testIsInValidVmOptions() { |
|
PowerMock.mockStatic(DesignerJavaRuntime.class); |
|
DesignerJavaRuntime designerJavaRuntime = PowerMock.createPartialMock(DesignerJavaRuntime.class, "isInstallVersion", "getJvmOptions"); |
|
String[] options = new String[]{"-Dfile.encoding=UTF-8", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"}; |
|
EasyMock.expect(designerJavaRuntime.getJvmOptions()).andReturn(options).anyTimes(); |
|
EasyMock.replay(designerJavaRuntime); |
|
PowerMock.replay(DesignerJavaRuntime.class); |
|
Assert.assertTrue(designerJavaRuntime.isInValidVmOptions()); |
|
} |
|
} |