我正在尝试使用 gwt junit 测试我的 gwt 应用程序,但似乎无法正确设置以使对象化被测试。所有教程都演示了测试 DataStore 但不对象化(这是更高级别的数据库服务) 我的测试基类如下所示:
public class TestBase {
private static final LocalServiceTestHelper helper =
    new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());
protected static ObjectifyFactory fact;
@BeforeClass
public static void setUp() {
    helper.setUp();
    fact = new ObjectifyFactory() {
        @Override
        public Objectify begin(ObjectifyOpts opts)
        {
            opts.setSessionCache(false);
            return super.begin(opts);
        }
    };
}
@AfterClass
public static void tearDown() {
    helper.tearDown();
}
}
然后我有扩展基础的类:
public class UserServiceTest extends TestBase{
private User inactiveUser;
private UserService us;
Objectify _ofy;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void beforeTest() {   
    //Register the classes used in the test
    fact.register(User.class);
    us = new UserService();
    inactiveUser = new User();
}   
@Test
public void basicTest(){
    Objectify ofy = ObjectifyService.begin();
    ofy.put(inactiveUser); //This fails with exception: An exception occurred: com.google.apphosting.api.ApiProxy$CallNotFoundException 
            //My goal is to reach these test but "addUser" uses also objectify
    //UserService.addUser("shpungin@gmail.com", "bye");
    //assertNotNull(inactiveUser.get_id());
}
你知道我做错了什么吗?我查看了整个互联网并没有找到解决方案(有些人甚至说要从 .classpath 中删除 app-engine-sdk ,但它似乎有效。
谢谢你。