package sg.ncl.adapter.deterlab.dtos.entities;

import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Test;

import java.util.Random;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

/**
 * @author Te Ye
 */
public class DeterLabUserEntityTest {

    @Test
    public void testGetId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();

        assertThat(deterLabUserEntity.getId(), is(nullValue()));
    }

    @Test
    public void testSetId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();
        final Long one = new Random().nextLong();
        deterLabUserEntity.setId(one);

        assertThat(deterLabUserEntity.getId(), is(equalTo(one)));
    }

    @Test
    public void testGetNclId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();

        assertThat(deterLabUserEntity.getNclUserId(), is(nullValue()));
    }

    @Test
    public void testSetNclId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();
        final String one = RandomStringUtils.randomAlphabetic(20);
        deterLabUserEntity.setNclUserId(one);

        assertThat(deterLabUserEntity.getNclUserId(), is(equalTo(one)));
    }

    @Test
    public void testGetDeterUserId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();

        assertThat(deterLabUserEntity.getDeterUserId(), is(nullValue()));
    }

    @Test
    public void testSetDeterUserId() throws Exception {
        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();
        final String one = RandomStringUtils.randomAlphabetic(20);
        deterLabUserEntity.setDeterUserId(one);

        assertThat(deterLabUserEntity.getDeterUserId(), is(equalTo(one)));
    }

}

@@ -92,16 +92,41 @@
 gUtils;%0A
+import org.junit.Before;%0A
 import o
@@ -189,152 +189,80 @@
 org.
-hamcrest.Matchers.equalTo;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.nullValue;%0Aimport static org.junit
+junit.Assert.assertEquals;%0Aimport static org.assertj.core.api
 .Assert
+ions
 .ass
@@ -291,12 +291,17 @@
 or T
-e Ye
+ran Ly Vu
 %0A */
@@ -348,350 +348,202 @@
     
-@Test%0A    public void testGetId() throws Exception %7B%0A        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity();%0A%0A        assertThat(deterLabUserEntity.getId(), is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void testSetId() throws Exception %7B%0A        final DeterLabUserEntity d
+private DeterLabUserEntity deterLabUserEntity;%0A%0A    @Before%0A    public void setup()%7B%0A        deterLabUserEntity=new DeterLabUserEntity();%0A    %7D%0A%0A    @Test%0A    public void getterAndS
 et
+t
 er
-LabUserEntity = new DeterLabUserEntity();
+Test() %7B
 %0A   
@@ -558,19 +558,27 @@
 al Long 
-one
+firstRandom
  = new R
@@ -634,237 +634,107 @@
 tId(
-one);%0A%0A        assertThat(deterLabUserEntity.getId(), is(equalTo(one)));%0A    %7D%0A%0A    @Test%0A    public void testGetNclId() throws Exception %7B%0A        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity(
+firstRandom);%0A%0A        final String secondRandom = RandomStringUtils.randomAlphabetic(20
 );%0A
-%0A
         
 asse
@@ -725,35 +725,24 @@
 0);%0A        
-assertThat(
 deterLabUser
@@ -740,33 +740,33 @@
 erLabUserEntity.
-g
+s
 etNclUserId(), i
@@ -765,176 +765,24 @@
 rId(
-), is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void testSetNclId() throws Exception %7B%0A        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity(
+secondRandom
 );%0A
+%0A
     
@@ -790,35 +790,43 @@
    final String 
-one
+thirdRandom
  = RandomStringU
@@ -886,21 +886,31 @@
 .set
-Ncl
+Deter
 UserId(
-one
+thirdRandom
 );%0A%0A
@@ -913,35 +913,37 @@
 );%0A%0A        
-assertThat(
+Long actual1=
 deterLabUser
@@ -956,146 +956,95 @@
 .get
-NclUserId(), is(equalTo(one))
+Id(
 );%0A    
-%7D%0A%0A
     
-@Test%0A    public void testGetDeterUserId() throws Exception %7B%0A        final DeterLabUserEntity 
+String actual2=deterLabUserEntity.getNclUserId();%0A        String actual3=
 dete
@@ -1061,33 +1061,23 @@
 tity
- = new 
+.get
 Deter
-Lab
 User
-Entity
+Id
 ();%0A
@@ -1100,224 +1100,121 @@
 hat(
-deterLabUserEntity.getDeterUserId(), is(nullValue())
+actual1).isNotNull(
 );%0A    
-%7D%0A%0A
     
-@Test%0A    public void testSetDeterUserId() throws Exception %7B%0A        final DeterLabUserEntity deterLabUserEntity = new DeterLabUserEntity
+assertThat(actual2).isNotNull();%0A        assertThat(actual3).isNotNull
 ();%0A
+%0A
         
 fina
@@ -1213,116 +1213,87 @@
     
-final String one = RandomStringUtils.randomAlphabetic(20);%0A        deterLabUserEntity.setDeterUserId(one
+assertEquals(firstRandom,actual1);%0A        assertEquals(secondRandom,actual2
 );%0A
-%0A
     
@@ -1306,66 +1306,34 @@
 sert
-That(deterLabUserEntity.getDeterUserId(), is(equalTo(one))
+Equals(thirdRandom,actual3
 );%0A 
@@ -1337,11 +1337,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Update unit testing for DeterLabUserEntity in adapter-deterlab(SIO)