@Nullable
    public String ensureUser(String userName, String password, String firstName, String lastName, String email,
                             Set<String> expectedRoles) {
        return ensureUser(userName, password, firstName, lastName, email, expectedRoles, false);
    }
@Test
    public void ensureUserWithSaveError() throws Exception {
        final Permissions permissions = new Permissions(ImmutableSet.of());

        when(userService.load("test-user")).thenReturn(null);
        when(userService.create()).thenReturn(newUser(permissions));
        when(userService.save(any(User.class))).thenThrow(ValidationException.class);

        assertThat(migrationHelpers.ensureUser("test-user", "pass", "Test", "User",
                                               "test@example.com", ImmutableSet.of("54e3deadbeefdeadbeef0001",
                                                                                   "54e3deadbeefdeadbeef0002")))
                .isNull();
    }