최근에 EasyMock에서 이상한 문제가 발생했습니다. 여기에 내가 여기EasyMock을 사용하여 org.openide.nodes.Node 메소드 호출로 함수를 처리 할 수 없습니다.
package com.test.junits;
import org.openide.nodes.Node;
public class IsRoot {
public boolean isRoot(Node node) {
Node parentNode = node.getParentNode();
return (parentNode == null);
}
}
테스트 그리고 오전 클래스는 내가 그것을 실행하려고의 JUnit 클래스
package com.test.junits
import static org.junit.Assert.assertNotNull;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.openide.nodes.Node;
public class IsRootTest {
private IsRoot isroot;
private Node node;
@Before
public void setUp() {
isroot = new IsRoot();
node = EasyMock.createMock(Node.class);
}
@Test
public void gettingExpectationsForGetParentFromNode() {
Node node = EasyMock.createMock(Node.class);
Node parentNode = EasyMock.createMock(Node.class);
EasyMock.expect(node.getParentNode()).andReturn(parentNode);
EasyMock.replay(node);
isroot.isRoot(node);
EasyMock.verify(node);
}
인의 I를 제외하고 다음
java.lang.IllegalStateException: no last call on a mock available
at org.easymock.EasyMock.getControlForLastCall(EasyMock.java:521)
at org.easymock.EasyMock.expect(EasyMock.java:499)
at com.test.junits.IsRootTest.gettingExpectationsForGetParentFromNode(IsRootTest.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
(메이븐과 이클립스)를 얻을
여기에 뭔가가 빠졌습니까? 도움이 될 것입니다.
http://stackoverflow.com/questions/3494969/easymock-3-0-mocking-class-throws-java-lang-illegalstateexception-no-last-call –