简体   繁体   English

Obngctify - No Class注册后,Appengine单元测试失败

[英]Appengine unit test fail with Objectify - No Class registered

I'm getting Class not registered exceptions during unit tests even though it has been registered. 即使已经注册,我也会在单元测试期间获得Class not registered exception。

Here is my test: 这是我的测试:

public class BaseObjectifyTest {
    private final LocalServiceTestHelper helper =
            new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig(),
                    new LocalMemcacheServiceTestConfig());

    Closeable session;

    @Before
    public void setup() {
        helper.setUp();
        session = ObjectifyService.begin();
    }

    @Test
    public void testThis() {
        MyEntity test = new MyEntity();
        ObjectifyService.register(MyEntity.class);
        ofy().save().entity(test).now();
    }

    @After
    public void tearDown() throws IOException {
        helper.tearDown();
        session.close();
        session = null;
    }
}

I've tried doing the ObjectifyService.run() and I get the same result. 我已经尝试过ObjectifyService.run(),我得到了相同的结果。 Any help would be great! 任何帮助都会很棒! Would like to write tests and if this doesn't work, I'll have to mock the objectify service. 想写测试,如果这不起作用,我将不得不嘲笑客观化服务。 Objectify 5.1.1 客观化5.1.1

在我的情况下,我使用JUnit和TestNG togeth并且测试的设置没有被执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM