Skip to content
Snippets Groups Projects
Commit 3f4e0422 authored by Ester Vilímková's avatar Ester Vilímková
Browse files

Adding Ids to CourseMapperTest

parent ad607fa6
No related branches found
No related tags found
2 merge requests!31M2,!23M2 course tests
Pipeline #
...@@ -5,6 +5,7 @@ import org.fuseri.model.dto.course.CourseDto; ...@@ -5,6 +5,7 @@ import org.fuseri.model.dto.course.CourseDto;
import org.fuseri.model.dto.course.LanguageTypeDto; import org.fuseri.model.dto.course.LanguageTypeDto;
import org.fuseri.model.dto.course.ProficiencyLevelDto; import org.fuseri.model.dto.course.ProficiencyLevelDto;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
...@@ -27,6 +28,13 @@ final class CourseMapperTest { ...@@ -27,6 +28,13 @@ final class CourseMapperTest {
@Autowired @Autowired
private CourseMapper CourseMapper; private CourseMapper CourseMapper;
@BeforeEach
void setUp()
{
course.setId(1L);
courseDto.setId(1L);
}
@Test @Test
void mapNullToDto() { void mapNullToDto() {
var createdDto = CourseMapper.mapToDto(null); var createdDto = CourseMapper.mapToDto(null);
...@@ -132,7 +140,6 @@ final class CourseMapperTest { ...@@ -132,7 +140,6 @@ final class CourseMapperTest {
void mapToCourseCourseCreateDto() { void mapToCourseCourseCreateDto() {
var createdCourse = CourseMapper.mapToCourse(courseCreateDto); var createdCourse = CourseMapper.mapToCourse(courseCreateDto);
Assertions.assertEquals(course.getId(), createdCourse.getId());
Assertions.assertEquals(course.getName(), createdCourse.getName()); Assertions.assertEquals(course.getName(), createdCourse.getName());
Assertions.assertEquals(course.getCapacity(), createdCourse.getCapacity()); Assertions.assertEquals(course.getCapacity(), createdCourse.getCapacity());
Assertions.assertEquals(course.getStudents(), createdCourse.getStudents()); Assertions.assertEquals(course.getStudents(), createdCourse.getStudents());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment