    @Test
    public void getHoldingsTest() {


        String username = "joe.coder@example.com";

        // define mocks
        Client client = mock(Client.class);
        User user = mock(User.class);
        UserProfile userProfile = mock(UserProfile.class);
        Principal principal = mock(Principal.class);

        // stub behaviour
        when(principal.getName()).thenReturn(username);
        when(client.getUser(username)).thenReturn(user);
        when(user.getProfile()).thenReturn(userProfile);
        when(userProfile.get("holdings")).thenReturn(
            "[" +
                "{\"crypto\": \"crypto-value1\", \"currency\": \"currency-value1\", \"amount\": \"amount-value1\"}," +
                "{\"crypto\": \"crypto-value2\", \"currency\": \"currency-value2\", \"amount\": \"amount-value2\"}" +
            "]");

        // test the controller
        HoldingsController holdingsController = new HoldingsController(client);
        List<Holding> holdings = holdingsController.getHoldings(principal);

        assertThat(holdings, contains(
                pojo(Holding.class)
                    .withProperty("crypto",   is("crypto-value1"))
                    .withProperty("currency", is("currency-value1"))
                    .withProperty("amount",   is("amount-value1")),
                pojo(Holding.class)
                    .withProperty("crypto",   is("crypto-value2"))
                    .withProperty("currency", is("currency-value2"))
                    .withProperty("amount",   is("amount-value2"))
        ));
    }