andrei-tara / dirty-mockito Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/dirty-mockito
License: MIT License
Automatically exported from code.google.com/p/dirty-mockito
License: MIT License
Yesterday I ran into a problem:
class A {
@EJB B b;
}
class B {
@Resource C c;
}
Testing "A" I can just mock for "B" (using your example code) but because "B"
needs "C" I can't run the test without NullPointerException.
So I wish it could be possible to handle this kind behaviour.
Original issue reported on code.google.com by DannyLade
on 26 Jan 2012 at 8:03
Version: 0.2
I've been looking around for something that integrates Spring and Mockito,
and this is an interesting approach.
I think it could be evolved to be more generally useful.
For example, I want to use a mock bean to test that my ReSTful web app is
calling the correct methods, and responding correctly to exceptions.
In this case, the mock needs to be available to the WebApplication context,
and it Mockito.reset(T ... mocks) needs to be called between each test.
Original issue reported on code.google.com by [email protected]
on 8 Sep 2009 at 2:19
Sometimes it is possible to use a Mockito.spy() instead of Mockito.mock() - if
you need mostly the orginal methods but mock just a few of them. In this case
it would be nice to have an annotation like this:
public class ATest extends ActiveTest<B> {
@Mock
private EntityManager em;
@Spy
private SomeService service = new SomeService();
...
// mock just one method
when(service.doIt()).thenReturn(result);
// it calls doIt()
service.doItNow();
verify(service).doIt();
...
It should be part of the automatic injection too (like @Mock).
Original issue reported on code.google.com by DannyLade
on 26 Jan 2012 at 8:13
Reason: It'd be nice to use dirty-mockito a bit more widely, but adding a
repository that can disappear is often not allowed on significant open source
and commercial projects.
I recently jumped through this hoop, and it wasn't as challenging as I'd
feared. Sonatype were very quick in setting up the staging repository and it
just took me a few iterations to pass the quality checks (i.e. that I was
providing sources, and javadoc).
If you'd like some help, then I'd be happy to oblige.
Original issue reported on code.google.com by [email protected]
on 21 Jun 2011 at 10:55
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.