@@ -0,0 +1,2586 @@
+package org.sagebionetworks.web.unitclient.view.users;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.verify;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.sagebionetworks.web.client.DisplayConstants;%0Aimport org.sagebionetworks.web.client.GWTWrapper;%0Aimport org.sagebionetworks.web.client.GlobalApplicationState;%0Aimport org.sagebionetworks.web.client.UserAccountServiceAsync;%0Aimport org.sagebionetworks.web.client.cookie.CookieProvider;%0Aimport org.sagebionetworks.web.client.view.users.RegisterWidget;%0Aimport org.sagebionetworks.web.client.view.users.RegisterWidgetView;%0Aimport org.sagebionetworks.web.shared.exceptions.ConflictException;%0Aimport org.sagebionetworks.web.shared.exceptions.RestServiceException;%0Aimport org.sagebionetworks.web.test.helper.AsyncMockStubber;%0A%0Aimport com.google.gwt.user.client.rpc.AsyncCallback;%0A%0Apublic class RegisterWidgetTest %7B%0A%09%0A%09RegisterWidgetView mockView;%0A%09CookieProvider mockCookieProvider;%0A%09UserAccountServiceAsync mockUserService;%0A%09GlobalApplicationState mockGlobalApplicationState;%0A%09GWTWrapper mockGWTWrapper;%0A%09%0A%09RegisterWidget widget;%0A%09String email = %22test@test.com%22;%0A%09@Before%0A%09public void setup() %7B%0A%09%09mockView = mock(RegisterWidgetView.class);%0A%09%09mockCookieProvider = mock(CookieProvider.class);%0A%09%09mockUserService = mock(UserAccountServiceAsync.class);%0A%09%09mockGlobalApplicationState = mock(GlobalApplicationState.class);%0A%09%09mockGWTWrapper = mock(GWTWrapper.class);%0A%09%09widget = new RegisterWidget(mockView, mockUserService, mockGlobalApplicationState, mockGWTWrapper);%09%09%09%0A%09%09verify(mockView).setPresenter(widget);%0A%09%09%0A%09%09AsyncMockStubber.callSuccessWith(null).when(mockUserService).createUserStep1(anyString(), anyString(), any(AsyncCallback.class));%0A%09%7D%0A%09%0A%09@Test%0A%09public void testRegisterUser() %7B%0A%09%09widget.registerUser(email);%0A%09%09verify(mockView).showInfo(anyString(), anyString());%0A%09%7D%0A%0A%09@Test%0A%09public void testRegisterUserUserExists() %7B%0A%09%09AsyncMockStubber.callFailureWith(new ConflictException(%22user exists%22)).when(mockUserService).createUserStep1(anyString(), anyString(), any(AsyncCallback.class));%0A%09%09widget.registerUser(email);%0A%09%09verify(mockView).showErrorMessage(anyString());%0A%09%7D%0A%0A%09@Test%0A%09public void testRegisterUserServiceFailure() %7B%0A%09%09AsyncMockStubber.callFailureWith(new RestServiceException(%22unknown error%22)).when(mockUserService).createUserStep1(anyString(), anyString(), any(AsyncCallback.class));%0A%09%09widget.registerUser(email);%0A%09%09%0A%09%09verify(mockView).showErrorMessage(DisplayConstants.ERROR_GENERIC_NOTIFY);%0A%09%7D%0A%0A%7D%0A

add test for new register widget