package me.shoutto.sdk;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;

/**
 * Test class
 */

public class UpdateUserRequestTest {

    @Test
    public void isValid_AllNullProperties_ShouldReturnFalse() {
        UpdateUserRequest updateUserRequest = new UpdateUserRequest();
        assertFalse(updateUserRequest.isValid());
    }

    @Test
    public void isValid_AtLeastOneNonNullProperty_ShouldReturnTrue() {
        UpdateUserRequest updateUserRequest = new UpdateUserRequest();
        updateUserRequest.setHandle("handle");
        assertTrue(updateUserRequest.isValid());
    }

    @Test
    public void adaptBaseEntity_ShouldReturnUserObjectWithAdaptedProperties() {
        String channel = "channel";
        String email = "email";
        String handle = "handle";
        String phone = "phone";
        String topic = "topic";
        List<String> channelSubscriptions = new ArrayList<>();
        channelSubscriptions.add(channel);
        List<String> topicPreferences = new ArrayList<>();
        topicPreferences.add(topic);

        UpdateUserRequest updateUserRequest = new UpdateUserRequest();
        updateUserRequest.setChannelSubscriptions(channelSubscriptions);
        updateUserRequest.setEmail(email);
        updateUserRequest.setHandle(handle);
        updateUserRequest.setPhone(phone);
        updateUserRequest.setTopicPreferences(topicPreferences);

        User user = (User)updateUserRequest.adaptToBaseEntity();
        assertEquals(email, user.getEmail());
        assertEquals(handle, user.getHandle());
        assertEquals(phone, user.getPhone());
        assertEquals(channel, user.getChannelSubscriptions().get(0));
        assertEquals(topic, user.getTopicPreferences().get(0));
    }
}

@@ -195,16 +195,68 @@
 tFalse;%0A
+import static junit.framework.Assert.assertNotNull;%0A
 import s
@@ -296,16 +296,16 @@
 rtTrue;%0A
-
 %0A/**%0A * 
@@ -1071,16 +1071,50 @@
 topic%22;%0A
+        String gender = %22gender%22;%0A
         
@@ -1647,16 +1647,61 @@
 rences);
+%0A        updateUserRequest.setGender(gender);
 %0A%0A      
@@ -1965,24 +1965,24 @@
 ().get(0));%0A
-
         asse
@@ -2029,20 +2029,473 @@
 ().get(0));%0A
+        assertEquals(gender, user.getMetaInfo().getGender());%0A    %7D%0A%0A    @Test%0A    public void adaptBaseEntity_ShouldReturnEmptyStringWhenFieldNullPassedIn() %7B%0A        UpdateUserRequest updateUserRequest = new UpdateUserRequest();%0A        updateUserRequest.setGender(null);%0A%0A        User user = (User)updateUserRequest.adaptToBaseEntity();%0A        assertNotNull(user.getMetaInfo().getGender());%0A        assertEquals(%22%22, user.getMetaInfo().getGender());%0A
     %7D%0A%7D%0A

Add tests for gender in UpdateUserRequest