Questions tagged [jukito]

Jukito is a library that combines Junit, Guice, and Mockito into a single tool to make injecting mocks into unit tests easier.

Jukito is a library that combines Junit, Guice, and Mockito into a single tool to make injecting mocks into unit tests easier.

20 questions
5
votes
2 answers

Missing method call for verify(mock), but there is one?

Introduction I'm attempting to make a test which verifies (using Mockito v1.9.5's verify) that a method with signature deinit() in an interface Bar is called after execution of a pass-through Foo.deinit(), and I'm hitting an error I really don't…
karobar
  • 1,250
  • 8
  • 30
  • 61
5
votes
3 answers

How do I register beans in camel unit tests that use beans?

I want to unit test single routes configured in java that uses beans. I read in camel in action (chapter 6.1.4) how to do this: protected RouteBuilder createRouteBuilder() throws Exception { return new myRoute(); } But in my case the rout needs…
dermoritz
  • 12,519
  • 25
  • 97
  • 185
4
votes
1 answer

How do I inject dependencies in Junit test case using Guice before @Rule runs?

Frameworks I'm working with are Dropwizard 7, Guice and for testing we have Junit with Jukito. I have a resource written in dw and I need to write a test case corresponding to that resource. Note: We recently migrated from dw 6 to dw 7. In dw 6 we…
Arshan Qureshi
  • 106
  • 2
  • 6
3
votes
3 answers

First stub is called when adding an additional stub

I have the following object which I want to test: public class MyObject { @Inject Downloader downloader; public List readFiles(String[] fileNames) { List files = new LinkedList<>(); for (String…
fwind
  • 1,274
  • 4
  • 15
  • 32
3
votes
0 answers

How to make JUnit catch logs and fail

I use slf4j extensively in my application. For stability reasons, there are scenarios where my code will gracefully handle an error condition and simply log it as an error and move on. However, I want to write tests that demonstrate that, for given…
durron597
  • 31,968
  • 17
  • 99
  • 158
3
votes
1 answer

JUnit test with GIN injection, without GWTTestCase and overloading gin modules?

I designed a new project using Guice/Gin so I could make our code more modular and swap-able especially when testing. However, I am not able to find out how to make this work in practice. I was under the impression that I could just create a new…
Casey Jordan
  • 1,204
  • 1
  • 20
  • 39
2
votes
1 answer

GWT Timer UnsatisfiedLinkError when testing with Jukito

I'm using Jukito to test a GWTP Presenter and in one of those that has a timer as a field for a repeating task I'm having this exception thrown. I'm running GWT 2.8.2, GWTP 1.6, JUnit 4 and Jukito 1.5 The test looks like…
Queek
  • 115
  • 1
  • 6
2
votes
1 answer

Multiple instance of DynamoDbLocal for each unit test class or singleton instantiation

I am trying to use DynamoDbLocal server for unit test cases. And came up with two options, Either define a junit class rule which starts local server before class and stops it after class. So essentially it will start and stop server for each unit…
sidss
  • 923
  • 1
  • 12
  • 20
2
votes
1 answer

How do I test gwtp addToPopupSlot?

I have a gwtp presenter, in some cases it must add to popupslot another presenter. How can I verify this fact in test? I'm using Jukito for tests. Presenter's code: ... @Override public void onAddPersonClick() { …
kosbr
  • 388
  • 2
  • 11
1
vote
1 answer

How do I bind a Generic class?

When I try to mock a Dao using Jukito I get the following exception: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType at org.jukito.JukitoModule.addKeyDependency(JukitoModule.java:338) at…
Sydney
  • 11,964
  • 19
  • 90
  • 142
1
vote
1 answer

Jukito Provider mock returns null

I am having some issues with a jukito unit test. I can't seem to mock Provider. Examples:. import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; @Singleton public class ServiceClass1 { @Inject …
CrazySabbath
  • 1,274
  • 3
  • 11
  • 33
1
vote
2 answers

Jukito/Mockito Test with static method

I am trying to test a class (using Jukito and Mockito), which unfortunately extends another class, which has a static method call. Is it possible to somehow skip this call? I would rather not use PowerMockito. public class A extends B { …
CrazySabbath
  • 1,274
  • 3
  • 11
  • 33
1
vote
1 answer

Maven, CDI, JUnit, JPA. Would like to run tests against HSQLDB

I've written a JEE6 application using CDI and JPA. My tests are written in JUnit. I'd like to run the database tests against an in-memory HSQLDB database in order to make sure my JPQL (which I consider 'code') is tested. My motivation is that that…
Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84
0
votes
0 answers

Constructor Argument mock using JukitoRunner/Mockito in Guice

Hi below is the legacy java code I have and I have to add new test cases to it. @RunWith(JukitoRunner.class) public class MyServiceTest { @Inject private MyService myService; public static class TestModule extends JukitoModule { …
Sammy Pawar
  • 1,201
  • 3
  • 19
  • 38
0
votes
1 answer

JukitoRunner, bind mock of final class

How to bind mock of final class in Jukito ? For example : public final class SomeFinalClass(){ public SomeFinalClass(String someString){ } } //Testing class @Runwith(JukitoRunner.class) public class TestingClass(){ @Inject private…
sidss
  • 923
  • 1
  • 12
  • 20
1
2