Minor refactorings and code style changes (#807)

* Made minor changes in some patterns such as removed throws clause where not needed, changed incorrect order of arguments in assertEquals

* 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

* Removed unused import from Promise

* Addressed review comments

* Addressed checkstyle issue
This commit is contained in:
Narendra Pathai
2018-10-23 13:45:41 +05:30
committed by GitHub
parent 25ed7c09c5
commit 2aa9e78ddd
112 changed files with 312 additions and 463 deletions

View File

@ -22,14 +22,6 @@
*/
package com.iluwatar.repository;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,6 +30,13 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.springframework.transaction.annotation.Transactional;
import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* This case is Just for test the Annotation Based configuration
*
@ -70,7 +69,7 @@ public class AppConfigTest {
result = resultSet.getString(1);
}
assertTrue(result.equals(expected));
assertEquals(expected, result);
}
}

View File

@ -31,7 +31,7 @@ import java.io.IOException;
*/
public class AppTest {
@Test
public void test() throws IOException {
public void test() {
String[] args = {};
App.main(args);
}

View File

@ -109,9 +109,7 @@ public class RepositoryTest {
List<Person> persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40));
assertEquals(3, persons.size());
assertTrue(persons.stream().allMatch((item) -> {
return item.getAge() > 20 && item.getAge() < 40;
}));
assertTrue(persons.stream().allMatch(item -> item.getAge() > 20 && item.getAge() < 40));
}
@Test