From 43660c4fe967e9691b1e0f48ce1900eb6555d082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Wed, 16 Sep 2020 17:14:37 +0200 Subject: [PATCH] Dodanie nowego testu do dodawnia kursu. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .../services/CourseServiceTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 buisnesslogic/src/test/java/com/plannaplan/services/CourseServiceTest.java diff --git a/buisnesslogic/src/test/java/com/plannaplan/services/CourseServiceTest.java b/buisnesslogic/src/test/java/com/plannaplan/services/CourseServiceTest.java new file mode 100644 index 0000000..05e1a38 --- /dev/null +++ b/buisnesslogic/src/test/java/com/plannaplan/services/CourseServiceTest.java @@ -0,0 +1,32 @@ +package com.plannaplan.services; + +import static org.junit.Assert.assertTrue; + +import com.plannaplan.entities.Course; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +@ContextConfiguration +public class CourseServiceTest { + @Autowired + private CourseService courseService; + + @Test + public void shoulReturnYes() { + Course course; + int startAmmount = this.courseService.getCoursesAmmount(); + + course = new Course(); + course.setName("Testowy kurs"); + course.setSymbol("TK"); + courseService.save(course); + assertTrue(this.courseService.getCoursesAmmount() > startAmmount); + } +}