Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6036531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:56:17+00:00 2026-05-23T05:56:17+00:00

Is it possible to use some mocking framework with Objectify? I’ve tried the following,

  • 0

Is it possible to use some mocking framework with Objectify?

I’ve tried the following, but it doesn’t work:

Foo mockFoo = mock(Foo.class);      
ObjectifyService.register(mockFoo.getClass());
ObjectifyUtil.get().put(mockFoo);

The error is:

java.lang.IllegalArgumentException: CGLIB$CALLBACK_0: org.mockito.internal.creation.MethodInterceptorFilter is not a supported property type.
    at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:184)
    at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:157)
    at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:123)
    at com.google.appengine.api.datastore.Entity.setProperty(Entity.java:320)
    at com.googlecode.objectify.impl.save.FieldSaver.setEntityProperty(FieldSaver.java:171)
    at com.googlecode.objectify.impl.save.LeafFieldSaver.saveValue(LeafFieldSaver.java:93)
    at com.googlecode.objectify.impl.save.FieldSaver.save(FieldSaver.java:156)
    at com.googlecode.objectify.impl.save.ClassSaver.save(ClassSaver.java:84)
    at com.googlecode.objectify.impl.Transmog.save(Transmog.java:342)
    at com.googlecode.objectify.impl.ConcreteEntityMetadata.toEntity(ConcreteEntityMetadata.java:231)
    at com.googlecode.objectify.impl.AsyncObjectifyImpl.put(AsyncObjectifyImpl.java:252)
    at com.googlecode.objectify.impl.AsyncObjectifyImpl.put(AsyncObjectifyImpl.java:229)
    at com.googlecode.objectify.impl.ObjectifyImpl.put(ObjectifyImpl.java:126)
    at org.foo.test.ApiTest.bar(ApiTest.java:89)
    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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    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)

Am I doing something wrong, or is this just not possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:56:18+00:00Added an answer on May 23, 2026 at 5:56 am

    In my opinion, mocking a framework as big as Objectify cannot rely upon Mockito.

    public class ProductTest {
      @Rule
      public EmbeddedDataStore store = new EmbeddedDataStore();
    
      @Before
      public void register() {
        ObjectifyService.register(Product.class);
      }
    
      @Test
      public void accessObjectifyWithSuccess() {
        Objectify ofy = ObjectifyService.begin();
        ofy.put(new Product());
        assertEquals(1, ofy.query(Product.class).list().size());
      }
    }
    

    The @Rule loads the datastore before the test. Then, the Product class is registered and the integration tests are run.

    So, with this technique, you can run tests on App Engine/Objectify without deploying an app.

    The following code is one way to code the datastore rule:

    import org.junit.rules.ExternalResource;
    import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
    
    public class EmbeddedDataStore extends ExternalResource {
      private static LocalServiceTestHelper helper;
    
      @Override
      protected void before() throws Throwable {
        helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig(),
          new LocalBlobstoreServiceTestConfig(), new LocalTaskQueueTestConfig(),
          new LocalMemcacheServiceTestConfig());
      }
    
      @Override
      protected void after() {
        helper.tearDown();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to get gdb or use some other tools to create a
Is it possible to manage native libraries (.so) under maven? We use some jars
Is it possible to use a DB sequence for some column that is not
is it possible to use something like an vim-close/exit-Event to execute some last commands
Is it possible to use some kind of attribute to throw an exception. This
Is it possible to use some Previous-Next Buttons instead of a slider as in
is it possible to use some kind of reflection on parameters in T-SQL module
Possible Duplicate: Any way to use some Scala for iOS coding? Would it be
Is it possible to tell Eclipse to use some extra arguments for aapt (-0
Is it possible to somehow link or use some convention so I can jump

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.