Showing
1 changed file
with
19 additions
and
0 deletions
1 | package org.legrog.web.publisher; | 1 | package org.legrog.web.publisher; |
2 | 2 | ||
3 | +import org.junit.jupiter.api.Nested; | ||
3 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
4 | import org.junit.jupiter.api.BeforeEach; | 5 | import org.junit.jupiter.api.BeforeEach; |
5 | import org.junit.jupiter.api.DisplayName; | 6 | import org.junit.jupiter.api.DisplayName; |
... | @@ -57,6 +58,10 @@ public class PublisherServiceDefaultTest { | ... | @@ -57,6 +58,10 @@ public class PublisherServiceDefaultTest { |
57 | this.publisherRepository = publisherRepository; | 58 | this.publisherRepository = publisherRepository; |
58 | } | 59 | } |
59 | 60 | ||
61 | + @Nested | ||
62 | + @DisplayName("addNewPublisher method") | ||
63 | + class AddNewPublisherTests { | ||
64 | + | ||
60 | @DisplayName("When a new publisher is added, both Publisher and PublisherVersion should be saved in the right state") | 65 | @DisplayName("When a new publisher is added, both Publisher and PublisherVersion should be saved in the right state") |
61 | @Test | 66 | @Test |
62 | public void testAddNewPublisher(@Mock PublisherVersionRepository publisherVersionRepository) { | 67 | public void testAddNewPublisher(@Mock PublisherVersionRepository publisherVersionRepository) { |
... | @@ -68,6 +73,12 @@ public class PublisherServiceDefaultTest { | ... | @@ -68,6 +73,12 @@ public class PublisherServiceDefaultTest { |
68 | verify(publisherVersionRepository).save(publisherVersion); | 73 | verify(publisherVersionRepository).save(publisherVersion); |
69 | } | 74 | } |
70 | 75 | ||
76 | + } | ||
77 | + | ||
78 | + @Nested | ||
79 | + @DisplayName("addVersionToPublisher method") | ||
80 | + class AddVersionToPublisherTests { | ||
81 | + | ||
71 | @DisplayName("When a new version of a publisher is added, setting it up, attaching it to publisher and saving both") | 82 | @DisplayName("When a new version of a publisher is added, setting it up, attaching it to publisher and saving both") |
72 | @Test | 83 | @Test |
73 | public void testAddVersionToPublisher(@Mock PublisherRepository publisherRepository, | 84 | public void testAddVersionToPublisher(@Mock PublisherRepository publisherRepository, |
... | @@ -81,6 +92,12 @@ public class PublisherServiceDefaultTest { | ... | @@ -81,6 +92,12 @@ public class PublisherServiceDefaultTest { |
81 | verify(publisherVersionRepository).save(publisherVersion1); | 92 | verify(publisherVersionRepository).save(publisherVersion1); |
82 | } | 93 | } |
83 | 94 | ||
95 | + } | ||
96 | + | ||
97 | + @Nested | ||
98 | + @DisplayName("addVersionToPublisher method") | ||
99 | + class ValidatePublisherVersionTests { | ||
100 | + | ||
84 | @DisplayName("When a PublisherVersion is validated, it should be the right one") | 101 | @DisplayName("When a PublisherVersion is validated, it should be the right one") |
85 | @Test | 102 | @Test |
86 | public void testValidateVersionRight() { | 103 | public void testValidateVersionRight() { |
... | @@ -137,4 +154,6 @@ public class PublisherServiceDefaultTest { | ... | @@ -137,4 +154,6 @@ public class PublisherServiceDefaultTest { |
137 | assertThat(publisherAction.getActionType()).isEqualTo(actionType); | 154 | assertThat(publisherAction.getActionType()).isEqualTo(actionType); |
138 | } | 155 | } |
139 | 156 | ||
157 | + } | ||
158 | + | ||
140 | } | 159 | } | ... | ... |
-
Please register or login to post a comment