I'm trying to unit test my DAO which uses the Criteria API. The Criteria object I have has a number of expressions and returns a unique result.
The problem I have is that when I use Jmock to create an expectation I have to create one for the criteria.uniqueResult() command and I have to set a return type. The return type is a custom ty...
Hi all, I wrote a method that retrieves certain list of strings, given a correct string key. Now when I create a list(the one to be retrieved by method descibed in previous sentence) and create test I can easily get results and test passes successfully.
Now on the other hand if I save the content of this list to database in 2 columns, ...
I'm little confused with Cactus and mock objects (jMock, Easy mock).
Could anyone please answer the following questions?
When to use Cactus for testing?
When not to use Cactus for testing?
When to use mock objects for testing?
When not to use mock objects for testing?
...
I'm writing tests for an application using the iBatis DAO framework. The app is running in a java 1.4 environment, so I'm using legacy versions of everything (JDK 1.4, JUnit3, iBatis 2.3 and JMock 1.2).
In my MockObjectTestCase subclass I have this test
public void testInsert() throws Exception {
Mock mockDao = mock(TblPpvFiltersD...
I am working on a Netbeans Platform RCP application.
I use jmock in my unit tests and I have created a Library Wrapper Module to import the necessary libraries.
The Module has an section named 'Libraries' and another section named 'Unit Test Libraries'.
I hoped that I could add the JMock Library Wrapper to the 'Unit Test Libraries', h...
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 should we use which?
...
Hello, I'm trying to learn how to write tests. I'm also learning Java, I was told I should learn/use/practice jMock, I've found some articles online that help to certain extend like :
http://www.theserverside.com/news/1365050/Using-JMock-in-Test-Driven-Development
http://jeantessier.com/SoftwareEngineering/Mocking.html#jMock
And most ...
I'm building a test, in wich i need to send question, and wait for the answer.
Message passing is not the problem. In fact to figure out wich answer correspond to wich question, i use an id. My id is generated using an UUID. an i want to retrieve this id, wich is given as a parameter to a mocked object.
It look like this:
oneOf(messag...
I'm trying to write a test for this class its called Receiver :
public void get(People person) {
if(null != person) {
LOG.info("Person with ID " + person.getId() + " received");
processor.process(person);
}else{
LOG.info("Person not received abort!");
...
This comparison shows, that JMockit has several advantages over other frameworks.
Are there also any advantages that one of the others (JMock, EasyMock, Mockito, Unitils, PowerMock + Mockito/EasyMock) has over JMockit?
...
I would love to be able to test java code with rspec under jruby, but can't see how to set expectations on internal java method calls. Given the following java:
public class A {
public String hi() {
return hello();
}
public String hello() {
return "yo";
}
}
I would love to be able to do:
describe 'A' do
it 'should ...
Solved. IntelliJ didn't highlight the fact that my imports were incomplete.
Hi,
I have a simple Scala program that I'm trying to develop using jMock. Setting basic expectations works nicely but for some reason Scala does not understand my attempt to return a value from a mock object. My maven build spews out the following error
TestLo...
I'm working on an existing JEE project with various maven modules that are developed in Eclipse, bundled together and deployed on JBoss using Java 1.6. I have the opportunity to prepare any framework and document how unit testing should be brought to the project.
Can you offer any advice on...
JUnit is where I expect to start, is this...
I sat down to write a matcher today and decided to take a quick look at the jmock documentation to refresh my memory on the process, and noticed a reference to the org.hamcrest.Factory annotation. The documentation for the annotation states.
Marks a Hamcrest static factory method so tools recognise them. A factory method is an equiv...
I'm interested in using the right mocking framework for my GWT app. It's my understanding that Mockito, EasyMock, and jMock are some of the most popular for Java. Could someone list pros/cons for the mocking framework that they are most familiar with as it relates to GWT to help fellow GWT testing noobs like myself?
Thanks in advance.
...
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 file. So maybe there's a solution with putting the jar into assets and making a custom class loader? That seems like a lot of trouble, but do...
Hey there
Need to setup JMock code to test call back with google protobuf
Full project is located at http://github.com/andrewmilkowski/template-transport
In short, following are methods signatures (below)
what I need to do is to test method getLongValue, using Jmock JUnit4Mockery
what is the best and cleanest way to go about this
...
Hi,
I am unable to include the new jMock release as Maven dependency. Here is what I tried including:
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
</dependency>
I have tried various combinations with the version and artifactId but it doesn't help.
Thanks,
Julia.
...
In one of our service classes I have a bunch of methods which just return the DAO result with no processing like
public void acceptRequest(User from, User to) {
rosterDAO.acceptRequest(from, to);
}
The unit test for this method looks like this
private final RosterDAO rosterDAO = context.mock(RosterDAO.class);
...
public void tes...
Is it possible to assing value to mock object. Ex:
myMockObject = context.mock(MyObject.class);
myMockObject.setId("someId");
My method which I'm testing reaches the end, but at the end there is method for validation of that object so object without id is considered to be invalid. Is there anything else I can do about this?
Can I so...