-
-
Save sonOfRa/b9ad08a521ef50e66f63e8b0f7aef348 to your computer and use it in GitHub Desktop.
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
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
@ActiveProfiles("test") | |
public class FeedbackServiceTests { | |
@Rule | |
public ExpectedException thrown = ExpectedException.none(); | |
@Test | |
public void testCreateInvalidTopicAndScale() { | |
CreateFeedback fb1 = new CreateFeedback(); | |
fb1.setEntryDate(TODAY); | |
fb1.setFeedbackDate(TODAY); | |
fb1.setFeedbackLocationId(1L); | |
fb1.setLocationId(1L); | |
fb1.setNote("A note"); | |
List<CreateFeedbackItem> items = new ArrayList<>(); | |
items.add(acceptedItemDtos.get(0)); | |
items.add(badScaleAndTopic); | |
fb1.setFeedbackItems(items); | |
for (CreateFeedbackItem item : items) { | |
item.setFeedback(fb1); | |
} | |
thrown.expect(NonAcceptedFeedbackException.class); | |
feedbackService.create(fb1); | |
Assert.assertEquals("There should be zero feedbacks in the database", | |
0, JdbcTestUtils.countRowsInTable(jdbcTemplate, "feedback")); | |
Assert.assertEquals("There should be zero feedback items in the database", | |
0, JdbcTestUtils.countRowsInTable(jdbcTemplate, "feedback_item")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment