From b7fde8375526bfeb5fb231661364428bf6467f8e Mon Sep 17 00:00:00 2001 From: Sebass van Boxel Date: Thu, 21 Mar 2019 10:38:19 +0100 Subject: [PATCH] AB#25 added tests for rating feature --- src/test/java/com/github/demo/model/BookTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/com/github/demo/model/BookTest.java b/src/test/java/com/github/demo/model/BookTest.java index 1bce639..8b9875c 100644 --- a/src/test/java/com/github/demo/model/BookTest.java +++ b/src/test/java/com/github/demo/model/BookTest.java @@ -37,6 +37,18 @@ public void testGetDetails() { Assert.assertNotNull(book.getDetails()); } + @Test + public void testSetInvalidRating() { + book.setRating(6); + Assert.assertEquals(5, book.getRating()); + } + + @Test + public void testSetNegativeRating() { + book.setRating(-1); + Assert.assertEquals(0, book.getRating()); + } + @Before public void setUp() throws Exception { book = new Book();