-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tests for TopicManagementService
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/java/de/stefanzindl/calendernews/boundary/TopicManagementServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package de.stefanzindl.calendernews.boundary; | ||
|
||
import de.stefanzindl.calendernews.dto.v1.TopicDto; | ||
import de.stefanzindl.calendernews.util.dto.TopicDtoBuilder; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
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.junit4.SpringRunner; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Test class for {@link ActionDayManagementService}. | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@SpringBootTest | ||
public class TopicManagementServiceTest { | ||
|
||
@Autowired | ||
private TopicManagementService topicManagementService; | ||
|
||
private TopicDto topicDto; | ||
|
||
/** | ||
* Initializes the test. | ||
*/ | ||
@Before | ||
public void init() { | ||
this.topicDto = TopicDtoBuilder.instance().build(); | ||
} | ||
|
||
/** | ||
* Saves and loads a topic-dto. | ||
*/ | ||
@Test | ||
public void createActionDayDtoWithoutTopicSuccessfully() { | ||
UUID identifier = this.topicManagementService.saveTopic(topicDto); | ||
TopicDto loadedTopic = topicManagementService.findTopicByTopicIdentifier(identifier); | ||
|
||
Assert.assertEquals(topicDto.getTopicIdentifier(), loadedTopic.getTopicIdentifier()); | ||
Assert.assertEquals(topicDto.getName(), loadedTopic.getName()); | ||
Assert.assertNotNull(loadedTopic); | ||
} | ||
} |