verify(bindingResult, never()).rejectValue(anyString(), anyString(), anyString());
}
@Test
public void registerUserWithIncorrectDetailsShouldFail() throws Exception {
RegisterUserDto userDto = createRegisterUserDto("", "", "", null);
Map<String, String> errors = new HashMap<>();
errors.put("userDto.email", "Invalid email length");
errors.put("userDto.username", "Invalid username length");
errors.put("userDto.password", "Invalid password length");
RegistrationPlugin plugin = mock(RegistrationPlugin.class);
when(plugin.getState()).thenReturn(Plugin.State.ENABLED);
when(plugin.registerUser(userDto.getUserDto(), 1L)).thenReturn(errors);
when(pluginService.getRegistrationPlugins()).thenReturn(
new ImmutableMap.Builder<Long, RegistrationPlugin>().put(1L, plugin).build());
when(bindingResult.hasErrors()).thenReturn(true);