~~~~0L-src/main/java/org/pack/ExerciseBoxes.java
public class ExerciseBoxes {
    /*
    Given a total number of boxes, we have to return the
    number of small boxes we need to use to reach the total
    number of boxes, with the constraint that we should first use
    as many big boxes as possible.

    1 big box = 5 small boxes

    For example, if we have: total = 16, big = 3, small = 5, the
    result would be 1. ( 3 big boxes = 15 boxes, so only 1 small box is
    needed).
    Return -1 in the case in which there are not enough small boxes
     */
}
~~~~

~~~~0R-src/main/java/org/pack/ExerciseBoxes.java
public class ExerciseBoxes {
    /*
    Given a total number of boxes, we have to return the
    number of small boxes we need to use to reach the total
    number of boxes, with the constraint that we should first use
    as many big boxes as possible.

    1 big box = 5 small boxes

    For example, if we have: total = 16, big = 3, small = 5, the
    result would be 1. ( 3 big boxes = 15 boxes, so only 1 small box is
    needed).
    Return -1 in the case in which there are not enough small boxes
     */
    public Integer calculate(Integer small, Integer big, Integer total) {
        Integer maxBigBoxes = total / 5;
        Integer bigBoxesWeCanUse;

        if (maxBigBoxes < big){
            bigBoxesWeCanUse = maxBigBoxes;
        } else {
            bigBoxesWeCanUse = big;
        }

        total = total - (bigBoxesWeCanUse * 5);

        if(small <= total)
            return -1;

        return total;
    }
}
~~~~

~~~~1L-src/test/java/org/pack/ExerciseBoxes.java
import org.junit.Test;

import static org.junit.Assert.assertEquals;
public class ExerciseBoxesTest {
}
~~~~

~~~~1R-src/test/java/org/pack/ExerciseBoxes.java
import org.junit.Test;

import static org.junit.Assert.assertEquals;
public class ExerciseBoxesTest {
    @Test
    public void simpleTest(){
        ExerciseBoxes ex = new ExerciseBoxes();
        Integer expected = 5;
        Integer result = ex.calculate(7,3,20);
        assertEquals(expected, result);
    }

    @Test
    public void impossibleTest(){
        ExerciseBoxes ex = new ExerciseBoxes();
        Integer expected = -1;
        Integer result = ex.calculate(3,3,20);
        assertEquals(expected, result);
    }
}
~~~~