package sg.ncl.service.user;

import org.junit.Assert;
import org.junit.Test;
import sg.ncl.service.user.data.jpa.repositories.UserRepository;
import sg.ncl.service.user.domain.User;

import javax.inject.Inject;
import java.util.List;

/**
 * Created by Desmond
 */
public class UserServiceTest extends AbstractTest {
    @Inject
    private UserRepository userRepository;

    @Test
    public void getAllUserWithNoUserInDbTest() throws Exception {
        UserService userService = new UserService(userRepository);
        List<User> list = userService.get();
        Assert.assertTrue(list.size() == 0);
    }


}

@@ -38,43 +38,338 @@
 org.
-junit.Assert;%0Aimport org.junit.Test
+apache.commons.lang3.RandomStringUtils;%0Aimport org.hamcrest.collection.IsIterableContainingInAnyOrder;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport sg.ncl.service.user.data.jpa.entities.AddressEntity;%0Aimport sg.ncl.service.user.data.jpa.entities.UserDetailsEntity;%0Aimport sg.ncl.service.user.data.jpa.entities.UserEntity
 ;%0Aim
@@ -500,16 +500,48 @@
 Inject;%0A
+import java.time.ZonedDateTime;%0A
 import j
@@ -934,11 +934,1774 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void getAllUserTest() throws Exception %7B%0A        UserService userService = new UserService(userRepository);%0A        User%5B%5D userArray = new User%5B3%5D;%0A%0A        for (int i = 0; i %3C 3; i++) %7B%0A            UserEntity%5B%5D userEntityArray = addUser();%0A            userArray%5Bi%5D = userEntityArray%5B0%5D;%0A        %7D%0A%0A        List%3CUser%3E userList2 = userService.get();%0A%0A        Assert.assertThat(userList2, IsIterableContainingInAnyOrder.containsInAnyOrder(userArray));%0A    %7D%0A%0A    private UserEntity%5B%5D addUser() throws Exception %7B%0A        final UserEntity userEntity = new UserEntity();%0A        userEntity.setApplicationDate(ZonedDateTime.now());%0A%0A        final UserDetailsEntity userDetailsEntity = new UserDetailsEntity();%0A        userDetailsEntity.setFirstName(RandomStringUtils.randomAlphabetic(20));%0A        userDetailsEntity.setLastName(RandomStringUtils.randomAlphabetic(20));%0A        userDetailsEntity.setEmail(RandomStringUtils.randomAlphabetic(20));%0A        userDetailsEntity.setPhone(RandomStringUtils.randomAlphabetic(20));%0A%0A        final AddressEntity address = new AddressEntity();%0A        address.setAddress1(RandomStringUtils.randomAlphabetic(20));%0A        address.setAddress2(RandomStringUtils.randomAlphabetic(20));%0A        address.setCountry(RandomStringUtils.randomAlphabetic(20));%0A        address.setRegion(RandomStringUtils.randomAlphabetic(20));%0A        address.setZipCode(RandomStringUtils.randomAlphabetic(20));%0A%0A        userDetailsEntity.setAddress(address);%0A        userEntity.setUserDetails(userDetailsEntity);%0A%0A        UserEntity saveUser = userRepository.save(userEntity);%0A%0A        final UserEntity%5B%5D userArray = new UserEntity%5B2%5D;%0A        userArray%5B0%5D = saveUser;%0A        userArray%5B1%5D = userEntity;%0A%0A        return userArray;%0A    %7D
 %0A%7D%0A

Add getAllUserTest.