Package com.googlecode.objectify.test.util

Source Code of com.googlecode.objectify.test.util.FakeLoadContext

/*
*/

package com.googlecode.objectify.test.util;

import com.googlecode.objectify.impl.LoadConditions;
import com.googlecode.objectify.impl.LoadEngine;
import com.googlecode.objectify.impl.translate.LoadContext;
import org.mockito.Matchers;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* Simplifies the load context just for testing
*
* @author Jeff Schnitzer <jeff@infohazard.org>
*/
public class FakeLoadContext extends LoadContext
{
  private static LoadEngine mockLoadEngine() {
    LoadEngine mock = mock(LoadEngine.class);
    when(mock.shouldLoad(Matchers.<LoadConditions>any())).thenReturn(false);
    return mock;
  }

  public FakeLoadContext() {
    super(mockLoadEngine());
  }
}
TOP

Related Classes of com.googlecode.objectify.test.util.FakeLoadContext

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.