Skip to content
/ Jukito Public

The combined power of JUnit, Guice and Mockito. Plus it sounds like a cool martial art.


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation


The combined power of JUnit, Guice and Mockito. Plus it sounds like a cool martial art.

So you started using dependency injection because somebody told you it would make your tests simpler? But as you gaze at your deep hierarchy of test classes, "simple" is not exactly the word you think of. Plus, creating a new mock whenever you add a parameter to an injected constructor gets old very quickly.

You are not alone! And Jukito was created specifically for people like you. Read on, or get started right away!

If you use Google Guice, or if your GWT application uses Gin, then Jukito is the perfect antidote to your unit testing headaches. Now you can write tests like this:

public class EmailSystemTest {

  @Inject EmailSystemImpl emailSystem;
  Email dummyEmail;

  public void setupMocks(
      IncomingEmails incomingEmails,
      EmailFactory factory) {
    dummyEmail = factory.createDummy();

  public void shouldFetchEmailWhenStarting(
      EmailView emailView) {
    // WHEN

    // THEN

That's right, Jukito lets you @Inject fields exactly as if your test class was injected with Guice. You can also inject parameters into your @Test, @Before and @After methods. Guice's just-in-time binding automatically instantiate your concrete classes, like EmailFactory. What about interfaces like IncomingEmails or EmailView? Jukito mocks them out automatically for you using mockito!

Let's look at another example:

public class CalculatorTest {

  public static class Module extends JukitoModule {
    protected void configureTest() {

          new AdditionExample(1, 1, 2),
          new AdditionExample(10, 10, 20),
          new AdditionExample(18, 24, 42));

  public void testAdd(@All Calculator calculator, @All AdditionExample example) {
    // WHEN
    int result = calculator.add(example.a, example.b);

    // THEN
    assertEquals(example.expected, result);

As you see here, Jukito lets you define your very own test module, where you can bind classes just like a regular Guice module. It doesn't stop there, however. The bindMany methods let you bind different classes or instances to the same interface. Combined with the powerful @All annotation this lets you easily run a single test on a whole suite of test examples. The code above will run a total of six tests!

Getting Started

Read the wiki to find out everything Jukito has to offer, and join the discussion!

Latest Release

  • 1.5


Thanks to