Search in sources :

Example 1 with AllUserPreferences

use of org.motechproject.mds.repository.internal.AllUserPreferences in project motech by motech.

the class UserPreferencesServiceTest method shouldCreateDefaultPreferences.

@Test
public void shouldCreateDefaultPreferences() {
    when(allUserPreferences.retrieveByClassNameAndUsername(CLASS_NAME, USERNAME)).thenReturn(null);
    userPreferencesService.getUserPreferences(15l, USERNAME);
    verify(allUserPreferences).create(userPreferencesCaptor.capture());
    UserPreferences capturedPreferences = userPreferencesCaptor.getValue();
    assertEquals(USERNAME, capturedPreferences.getUsername());
    assertEquals(CLASS_NAME, capturedPreferences.getClassName());
    assertNotNull(capturedPreferences.getSelectedFields().size());
    assertEquals(0, capturedPreferences.getSelectedFields().size());
    assertEquals(0, capturedPreferences.getUnselectedFields().size());
}
Also used : AllUserPreferences(org.motechproject.mds.repository.internal.AllUserPreferences) UserPreferences(org.motechproject.mds.domain.UserPreferences) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 UserPreferences (org.motechproject.mds.domain.UserPreferences)1 AllUserPreferences (org.motechproject.mds.repository.internal.AllUserPreferences)1