Minor refactorings and code style changes. 1) Removed several use of raw types 2) Removed unnecessary throws clauses 3) Used lambda expressions wherever applicable 4) Used apt assertion methods for readability 5) Use of try with resources wherever applicable 6) Corrected incorrect order of assertXXX arguments

This commit is contained in:
Narendra Pathai
2018-10-20 17:50:52 +05:30
parent 2f569d670a
commit 543eb9a4be
73 changed files with 207 additions and 298 deletions

View File

@@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class QueenTest {
@Test
public void testNotFlirtyUncomplemented() throws Exception {
public void testNotFlirtyUncomplemented() {
final Queen queen = new Queen();
queen.setFlirtiness(false);
queen.changeMood();
@@ -44,7 +44,7 @@ public class QueenTest {
}
@Test
public void testNotFlirtyComplemented() throws Exception {
public void testNotFlirtyComplemented() {
final Queen queen = new Queen();
queen.setFlirtiness(false);
queen.receiveCompliments();
@@ -53,14 +53,14 @@ public class QueenTest {
}
@Test
public void testFlirtyUncomplemented() throws Exception {
public void testFlirtyUncomplemented() {
final Queen queen = new Queen();
queen.changeMood();
assertFalse(queen.getMood());
}
@Test
public void testFlirtyComplemented() throws Exception {
public void testFlirtyComplemented() {
final Queen queen = new Queen();
queen.receiveCompliments();
queen.changeMood();

View File

@@ -41,7 +41,7 @@ import static org.mockito.Mockito.when;
public class ServantTest {
@Test
public void testFeed() throws Exception {
public void testFeed() {
final Royalty royalty = mock(Royalty.class);
final Servant servant = new Servant("test");
servant.feed(royalty);
@@ -50,7 +50,7 @@ public class ServantTest {
}
@Test
public void testGiveWine() throws Exception {
public void testGiveWine() {
final Royalty royalty = mock(Royalty.class);
final Servant servant = new Servant("test");
servant.giveWine(royalty);
@@ -59,7 +59,7 @@ public class ServantTest {
}
@Test
public void testGiveCompliments() throws Exception {
public void testGiveCompliments() {
final Royalty royalty = mock(Royalty.class);
final Servant servant = new Servant("test");
servant.giveCompliments(royalty);
@@ -68,7 +68,7 @@ public class ServantTest {
}
@Test
public void testCheckIfYouWillBeHanged() throws Exception {
public void testCheckIfYouWillBeHanged() {
final Royalty goodMoodRoyalty = mock(Royalty.class);
when(goodMoodRoyalty.getMood()).thenReturn(true);