From 7d57157078ab6c522cfc06b9ede137659ec1e21a Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Sat, 24 Oct 2020 17:08:51 +0200 Subject: [PATCH] Mapper test --- .../mappers/UserResponseMappersTest.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/restservice/src/test/java/com/plannaplan/responses/mappers/UserResponseMappersTest.java b/restservice/src/test/java/com/plannaplan/responses/mappers/UserResponseMappersTest.java index 132dbb1..f393f03 100755 --- a/restservice/src/test/java/com/plannaplan/responses/mappers/UserResponseMappersTest.java +++ b/restservice/src/test/java/com/plannaplan/responses/mappers/UserResponseMappersTest.java @@ -2,11 +2,31 @@ package com.plannaplan.responses.mappers; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.Arrays; +import java.util.List; + +import com.plannaplan.entities.User; +import com.plannaplan.types.UserRoles; +import com.plannaplan.responses.models.SearchForStudentsResponse; + import org.junit.Test; public class UserResponseMappersTest { + private static final String F_NAME = "Tytus"; + private static final String F_SURNAMENAME = "Romek"; + private static final String F_EMAIL = "i@Atomek.pl"; + + private static final String S_NAME = "Ed"; + private static final String S_SURNAMENAME = "Edd"; + private static final String S_EMAIL = "i@Eddy.pl"; + @Test public void shlouldMapListToResponseList() { - assertTrue(false); + final List users = Arrays.asList(new User(F_NAME, F_SURNAMENAME, F_EMAIL, UserRoles.TEST_USER), + new User(S_NAME, S_SURNAMENAME, S_EMAIL, UserRoles.TEST_USER)); + + final List resposne = UserResponseMappers.mapToDefaultResponse(users); + assertTrue(resposne.size() == 2); + assertTrue(resposne.get(0) instanceof SearchForStudentsResponse); } }