Package com.springsource.greenhouse.account

Examples of com.springsource.greenhouse.account.AccountRepository


public class SignupControllerTest {

  @Test
  public void signupFromApi_happyTest() throws Exception {
    AccountRepository accountRepository = mock(AccountRepository.class);   
    SignedUpGateway gateway = mock(SignedUpGateway.class);   
    SignupController signupController = new SignupController(accountRepository, gateway);
   
    String signupJson = "{\"first-name\":\"Roy\",\"last-name\":\"Clarkson\",\"email\":\"roy@clarkson.com\",\"confirm-email\":\"roy@clarkson.com\",\"gender\":\"M\",\"birthdate\":{\"month\":7,\"day\":8,\"year\":1976},\"password\":\"letmein\"}";
    MockMvc mockMvc = standaloneSetup(signupController).build();
View Full Code Here


        .andExpect(MockMvcResultMatchers.jsonPath("message", Matchers.equalTo("Account created")));
  }
 
  @Test
  public void signupFromApi_duplicateEmail() throws Exception {
    AccountRepository accountRepository = mock(AccountRepository.class);
    when(accountRepository.createAccount(any(Person.class))).thenThrow(new EmailAlreadyOnFileException("roy@clarkson.com"));
    SignedUpGateway gateway = mock(SignedUpGateway.class);   
    SignupController signupController = new SignupController(accountRepository, gateway);
   
    String signupJson = "{\"first-name\":\"Roy\",\"last-name\":\"Clarkson\",\"email\":\"roy@clarkson.com\",\"confirm-email\":\"roy@clarkson.com\",\"gender\":\"M\",\"birthdate\":{\"month\":7,\"day\":8,\"year\":1976},\"password\":\"letmein\"}";
    MockMvc mockMvc = standaloneSetup(signupController).build();
View Full Code Here

        .andExpect(MockMvcResultMatchers.jsonPath("errors[0].message", Matchers.equalTo("already on file")));
  }
 
  @Test
  public void signupFromApi_validationErrors() throws Exception {
    AccountRepository accountRepository = mock(AccountRepository.class);
    when(accountRepository.createAccount(any(Person.class))).thenThrow(new EmailAlreadyOnFileException("roy@clarkson.com"));
    SignedUpGateway gateway = mock(SignedUpGateway.class);   
    SignupController signupController = new SignupController(accountRepository, gateway);
   
    String signupJson = "{\"first-name\":null,\"last-name\":\"Clarkson\",\"email\":\"roy@clarkson.com\",\"confirm-email\":\"roy@clarkson.com\",\"gender\":\"M\",\"birthdate\":{\"month\":7,\"day\":8,\"year\":1976},\"password\":\"letmein\"}";
    MockMvc mockMvc = standaloneSetup(signupController).build();
View Full Code Here

        .andExpect(MockMvcResultMatchers.jsonPath("errors[0].message", Matchers.equalTo("may not be empty")));
  }
 
  @Test
  public void signupFromApi_mismatchedEmails() throws Exception {
    AccountRepository accountRepository = mock(AccountRepository.class);
    when(accountRepository.createAccount(any(Person.class))).thenThrow(new EmailAlreadyOnFileException("roy@clarkson.com"));
    SignedUpGateway gateway = mock(SignedUpGateway.class);   
    SignupController signupController = new SignupController(accountRepository, gateway);
   
    String signupJson = "{\"first-name\":\"Roy\",\"last-name\":\"Clarkson\",\"email\":\"roy@clarkson.com\",\"confirm-email\":\"rclarkson@vmware.com\",\"gender\":\"M\",\"birthdate\":{\"month\":7,\"day\":8,\"year\":1976},\"password\":\"letmein\"}";
    MockMvc mockMvc = standaloneSetup(signupController).build();
View Full Code Here

TOP

Related Classes of com.springsource.greenhouse.account.AccountRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.