jmock Questions

2

Solved

I was experimenting jMock as my mocking framework for my project. I came into a situation where I need to mock both a class and an interface. I used the ClassImposteriser.INSTANCE to initiate the i...
Subdeacon asked 9/6, 2009 at 4:43

5

Solved

My method looks like this: public class Decompile extends JdbcDaoSupport public void getRunner(){ String val = this.getJdbcTemplate().queryForObject(sql,String.class, new Object[]{1001}); } } Pl...
Renovate asked 11/12, 2012 at 10:51

3

Solved

Is there a way to match the following string with any of the hamcrest matchers. "{\"messageType\":\"identify\",\"_id\":\"7de9a446-2ced-4bda-af35-81e95ad2dc32\",\"address\":\"192.168.0.0\",\"port\"...
Samora asked 21/12, 2011 at 10:17

2

Solved

How can I use JMock on the Android? I've several posts saying its not possible, but surely there's some way to do it? The issue seems to be getting the Android to even recognize the JMock jar fil...
Pascal asked 27/8, 2010 at 1:6

3

I'm new to Jmockit and I'm trying to mock jdbcTemplate.udpate() using the following verification, new Expectations() {{ someRef.flushUpdates(); }}; new Verifications() {{ String query; jdbc...
Acetous asked 9/4, 2018 at 15:12

2

Solved

Background: This is a JMock+JUnit specific question (those are the two technologies I must use). Yes, what I want to do can be done with PowerMock, but this is an edge case that doesn't warrant ch...
Eglantine asked 3/4, 2014 at 15:41

6

Solved

Sometimes, you want to test a class method and you want to do an expectation on a call of a super class method. I did not found a way to do this expectation in java using easymock or jmock (and I t...
Solarize asked 7/3, 2009 at 23:54

3

Solved

Is there an already built-in, standard way in JMock to capture method arguments to test the argument object later on with standard JUnit functionality? Something like final CapturedContainer<S...
Ephialtes asked 17/6, 2011 at 12:39

4

Solved

I have a Class A which has an internal Cache represented by a Class B. this inner class is private since the cache need not be visible to external consumers and is only to assist the outer class A....
Wortman asked 28/6, 2015 at 14:56

3

I've written a transformer class that takes an HttpServletRequest and transforms it into another type that holds a pointer to the InputStream from the servlet request. (The idea is to abstract the ...
Hankhanke asked 28/2, 2012 at 0:54

1

After upgrading to Java 8. I now have compile errors of the following kind: The method with(Matcher<Object>) is ambiguous for the type new Expectations(){} It is caused by this method call...
Nictitate asked 6/5, 2015 at 21:20

1

I recently upgraded from jMock 2.5.1 to 2.6.0, and it seems that some of its dependencies have changed, causing some of my previously passing tests to fail. One of my tests has the following expec...
Guarded asked 23/2, 2015 at 16:20

2

Solved

The book Growing Object Oriented Software gives several examples in jMock where the state is made explicit without exposing it through an API. I really like this idea. Is there a way to do this in ...
Baldridge asked 3/7, 2011 at 22:38

1

Solved

I have a test class that looks like @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/test-context.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST...
Lenient asked 20/1, 2014 at 16:59

4

Is there any way in java to check if a certain method was called inside another method? I am testing a class and the method I am having trouble with plays sound and there is virtually no way of get...
Boccioni asked 15/5, 2013 at 7:17

1

I want to unit test this Spring controller method: @Autowired private MyValidator validator; public String register( HttpServletRequest request, ModelMap model, Principal principal, @PathVa...
Mansour asked 7/12, 2012 at 8:14

3

Solved

I wish to achieve the following behavior. My class under test has a dependency on some other class, I wish to mock this dependency with jMock. Most of the methods would return some standard values,...
Kutuzov asked 31/8, 2012 at 7:50

5

Solved

I am trying to get through my very first JMOCK tutorial http://www.jmock.org/getting-started.html, and it didn't go well. The problem I encountered is below: java.lang.SecurityException: class ...
Burtonburty asked 21/1, 2011 at 4:40

1

The method I want to test is calling a mock method with different arguments: public void methodToTest(){ getMock().doSomething(1); getMock().doSomething(2); getMock().doSomething(3); } In my ...
Corbeil asked 1/6, 2012 at 15:23

3

Solved

I am currently writing a couple of tests involving JMock. I cannot understand the following structure of the code: context.checking(new Expectations() { //context is of type Mockery of course { ...
Weighin asked 26/5, 2012 at 19:13

3

Solved

I would like to know if I can mock a super class constructors call and its super() calls. For example, I have the following classes class A { A(..) { super(..) } } class B extends A { B(C ...
Selfloading asked 2/5, 2012 at 20:41

3

Solved

If writing a Java unit test with mocking using JMock, should we use Mockery context = new Mockery() or Mockery context = new JUnit4Mockery() What is the difference between the two, and when...
Roth asked 13/5, 2010 at 8:18

2

Solved

I have a particularly nasty JMock checking() block for a JPA query that I want to migrate to Mockito: Mockery jMock = new Mockery(); final EntityManager fakeEntityManager = jMock.mock(EntityManage...
Oxymoron asked 8/2, 2012 at 10:1

1

Solved

I'm trying to write JUnit tests for my code but with in some of my methods other methods are called. Is it possible to mock these calls out? E.g. s3FileWrite(File file, Status status) { S3 s3 = ...
Hachmin asked 11/1, 2012 at 11:37

3

I have such situation - I have interface (say MyInterface) and simple partial implementation (AbstractMyInterface). The latter adds a few protected methods which I would like to test. Currently I ...
Episodic asked 4/12, 2011 at 13:15

© 2022 - 2024 — McMap. All rights reserved.