import in.partake.controller.ActionProxy;
public class SetPreferenceAPITest extends APIControllerTest {
@Test
public void testToSetPreferenceWithLogin() throws Exception {
ActionProxy proxy = getActionProxy(POST, "/api/account/setPreference");
UserPreference pref = loadUserPreference(TestDataProvider.DEFAULT_USER_ID);
Assert.assertEquals(true, pref.isProfilePublic());
Assert.assertEquals(true, pref.isReceivingTwitterMessage());
Assert.assertEquals(false, pref.tweetsAttendanceAutomatically());
loginAs(proxy, TestDataProvider.DEFAULT_USER_ID);
addValidSessionTokenToParameter(proxy);
addParameter(proxy, "profilePublic", "false");
addParameter(proxy, "receivingTwitterMessage", "false");
addParameter(proxy, "tweetingAttendanceAutomatically", "false");
proxy.execute();
assertResultOK(proxy);
pref = loadUserPreference(TestDataProvider.DEFAULT_USER_ID);
Assert.assertEquals(false, pref.isProfilePublic());