public void registerUserShouldFailIfPluginThrowsNoConnectionException() throws Exception {
RegisterUserDto userDto = createRegisterUserDto("username", "password", "email@email.em", null);
RegistrationPlugin plugin = mock(RegistrationPlugin.class);
when(plugin.getState()).thenReturn(Plugin.State.ENABLED);
when(plugin.registerUser(userDto.getUserDto(), 1L))
.thenThrow(new NoConnectionException());
when(pluginService.getRegistrationPlugins()).thenReturn(
new ImmutableMap.Builder<Long, RegistrationPlugin>().put(1L, plugin).build());
when(bindingResult.hasErrors()).thenReturn(true);