Java Code Examples for org.jmock.Mockery#setImposteriser()

The following examples show how to use org.jmock.Mockery#setImposteriser() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlexDirectionTest.java    From mini2Dx with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	Mdx.locks = new JvmLocks();

	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	layoutState = mockery.mock(LayoutState.class);
	renderTree = mockery.mock(UiContainerRenderTree.class);
	
	mockery.checking(new Expectations() {
		{
			atLeast(1).of(layoutState).getUiContainerRenderTree();
			will(returnValue(renderTree));
			atLeast(1).of(renderTree).transferLayoutDeferred(with(any(Array.class)));
		}
	});
}
 
Example 2
Source File: RenderNodeTest.java    From mini2Dx with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	Mdx.platform = Platform.WINDOWS;

	parentElement.setVisibility(Visibility.VISIBLE);
	parentElement.setPreferredContentWidth(PARENT_WIDTH);
	parentElement.setPreferredContentHeight(PARENT_HEIGHT);
	
	uiElement.setVisibility(Visibility.VISIBLE);
	uiElement.setPreferredContentWidth(ELEMENT_WIDTH);
	uiElement.setPreferredContentHeight(ELEMENT_HEIGHT);
	parentRenderNode.addChild(renderNode);
	
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	layoutState = mockery.mock(LayoutState.class);
	renderTree = mockery.mock(UiContainerRenderTree.class);
}
 
Example 3
Source File: RenderLayerTest.java    From mini2Dx with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
	parentElement.setVisibility(Visibility.VISIBLE);
	uiElement1.setVisibility(Visibility.VISIBLE);
	uiElement2.setVisibility(Visibility.VISIBLE);
	
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	layoutState = mockery.mock(LayoutState.class);
	renderTree = mockery.mock(UiContainerRenderTree.class);
	
	renderLayer.add(renderNode1);
	renderLayer.add(renderNode2);

	mockery.checking(new Expectations() {
		{
			atLeast(1).of(renderTree).transferLayoutDeferred(with(any(Array.class)));
		}
	});
}
 
Example 4
Source File: ChannelInitializerTest.java    From nanofix with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception
{
    mockery = new Mockery();
    mockery.setImposteriser(ClassImposteriser.INSTANCE);
    transport = mockery.mock(Transport.class);
    byteChannelReader = mockery.mock(ByteChannelReader.class);
    outboundMessageHandler = mockery.mock(OutboundMessageHandler.class);
    writableByteChannel = mockery.mock(WritableByteChannel.class);
    readableByteChannel = mockery.mock(ReadableByteChannel.class);

    mockery.checking(new Expectations()
    {
        {
            ignoring(writableByteChannel);
        }
    });
}
 
Example 5
Source File: AnimationTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	sprite = mockery.mock(Sprite.class);
	color = mockery.mock(Color.class);

	mockery.checking(new Expectations(){
		{
			exactly(5).of(sprite).getOriginX();
			will(returnValue(1f));
			exactly(5).of(sprite).getOriginY();
			will(returnValue(1f));
			exactly(1).of(sprite).getTint();
			will(returnValue(color));
		}
	});
	
	animation = new Animation<Sprite>();

	for (int i = 0; i < 5; i++) {
		animation.addFrame(sprite, 0.5f);
	}
	
	Assert.assertEquals(0, animation.getCurrentFrameIndex());
	Assert.assertEquals(5, animation.getNumberOfFrames());
}
 
Example 6
Source File: RenderPipelineTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	operation1 = mockery.mock(RenderOperation.class, "operation1");
	operation2 = mockery.mock(RenderOperation.class, "operation2");
	gc = mockery.mock(GameContainer.class);
	g = mockery.mock(Graphics.class);
	
	pipeline = new RenderPipeline();
	pipeline.add(operation1);
	pipeline.add(operation2);
}
 
Example 7
Source File: DivRenderNodeTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	theme = mockery.mock(UiTheme.class);
	renderTree = mockery.mock(UiContainerRenderTree.class);
	div.setFlexLayout("flex-col:xs-3c");
	
	div.setVisibility(Visibility.VISIBLE);
	flexRow1.setVisibility(Visibility.VISIBLE);
	flexRow2.setVisibility(Visibility.VISIBLE);
	
	rowRenderNode1.addChild(renderNode1);
	rowRenderNode1.addChild(renderNode2);
	rowRenderNode2.addChild(renderNode3);
	rowRenderNode2.addChild(renderNode4);

	divRenderNode.addChild(rowRenderNode1);
	divRenderNode.addChild(rowRenderNode2);

	mockery.checking(new Expectations() {
		{
			atLeast(1).of(renderTree).transferLayoutDeferred(with(any(Array.class)));
		}
	});
}
 
Example 8
Source File: LibgdxGraphicsTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	fonts = mockery.mock(Fonts.class);
	gameFont = mockery.mock(GameFont.class);
	gameWrapper = mockery.mock(GameWrapper.class);
	spriteBatch = mockery.mock(LibgdxSpriteBatchWrapper.class);
	polygonSpriteBatch = mockery.mock(PolygonSpriteBatch.class);
	shapeRenderer = mockery.mock(ShapeRenderer.class);
	gdxGraphics = mockery.mock(com.badlogic.gdx.Graphics.class);

	Mdx.fonts = fonts;
	Gdx.graphics = gdxGraphics;
	
	mockery.checking(new Expectations() {
		{
			one(shapeRenderer).setAutoShapeType(true);
			one(fonts).defaultFont();
			will(returnValue(gameFont));
			one(gdxGraphics).getWidth();
			will(returnValue(800));
			one(gdxGraphics).getHeight();
			will(returnValue(600));
			one(spriteBatch).getColor();
			will(returnValue(new Color()));
		}
	});
	
	graphics = new LibgdxGraphics(gameWrapper, spriteBatch, polygonSpriteBatch, shapeRenderer);
}
 
Example 9
Source File: LibgdxTextureRegionTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	mockery = new Mockery();
	mockery.setImposteriser(ClassImposteriser.INSTANCE);
	
	texture = mockery.mock(LibgdxTexture.class);
	mockery.checking(new Expectations(){
		{
			atLeast(1).of(texture).getWidth();
			will(returnValue(TEXTURE_WIDTH));
			atLeast(1).of(texture).getHeight();
			will(returnValue(TEXTURE_HEIGHT));
		}
	});
}
 
Example 10
Source File: TcpTransportTest.java    From nanofix with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{
    mockery = new Mockery();
    mockery.setImposteriser(ClassImposteriser.INSTANCE);
    publishingTransportObserver = mockery.mock(PublishingConnectionObserver.class);
    serverSocketChannel = mockery.mock(DelegatingServerSocketChannel.class);
    socketFactory = mockery.mock(SocketFactory.class);
    socketAddress = new InetSocketAddress("host", 222);
}
 
Example 11
Source File: SSHExecProcessAdapterTest.java    From teamcity-deployer-plugin with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup() {
  myContext = new Mockery();
  myContext.setImposteriser(ClassImposteriser.INSTANCE);

  mySessionProvider = myContext.mock(SSHSessionProvider.class);
  mySession = myContext.mock(Session.class);
  myChannel = myContext.mock(ChannelExec.class);
  myLogger = myContext.mock(BuildProgressLogger.class);
  myAdapter = newAdapter(myLogger);
  commonExpectations();
}
 
Example 12
Source File: InitializerTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 13
Source File: JettyHelperTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 14
Source File: ClientHttpRequestJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 15
Source File: SerializableObjectHttpMessageConverterJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 16
Source File: InitializerTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 17
Source File: JettyHelperTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 18
Source File: ClientHttpRequestJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}
 
Example 19
Source File: SerializableObjectHttpMessageConverterJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  mockContext = new Mockery();
  mockContext.setImposteriser(ClassImposteriser.INSTANCE);
}