Browse Source

REPORT-46916 修复单元测试

persist/11.0
loy 4 years ago
parent
commit
99b2c3f973
  1. 9
      designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java

9
designer-realize/src/test/java/com/fr/nx/app/designer/CptxAppTest.java

@ -4,7 +4,6 @@ import com.fr.file.AbstractFILE;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.nx.app.designer.utils.DesignerCptxFileUtils; import com.fr.nx.app.designer.utils.DesignerCptxFileUtils;
import com.fr.nx.cptx.utils.CptxFileUtils;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
@ -22,7 +21,7 @@ import org.powermock.modules.junit4.PowerMockRunnerDelegate;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(JUnit4.class) @PowerMockRunnerDelegate(JUnit4.class)
@PrepareForTest({ @PrepareForTest({
CptxFileUtils.class DesignerCptxFileUtils.class
}) })
public class CptxAppTest { public class CptxAppTest {
@ -35,7 +34,7 @@ public class CptxAppTest {
@Test @Test
public void testAsIOFile() { public void testAsIOFile() {
PowerMock.mockStatic(CptxFileUtils.class); PowerMock.mockStatic(DesignerCptxFileUtils.class);
FILE file = new AbstractFILE() { FILE file = new AbstractFILE() {
}; };
WorkBook workBook = new WorkBook(); WorkBook workBook = new WorkBook();
@ -43,12 +42,12 @@ public class CptxAppTest {
.andReturn(workBook).once() .andReturn(workBook).once()
.andReturn(null).once(); .andReturn(null).once();
PowerMock.replay(CptxFileUtils.class); PowerMock.replay(DesignerCptxFileUtils.class);
Assert.assertSame(workBook, new CptxApp().asIOFile(file)); Assert.assertSame(workBook, new CptxApp().asIOFile(file));
Assert.assertNotNull(new CptxApp().asIOFile(file)); Assert.assertNotNull(new CptxApp().asIOFile(file));
PowerMock.verify(CptxFileUtils.class); PowerMock.verify(DesignerCptxFileUtils.class);
} }

Loading…
Cancel
Save