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());
}
Aggregations