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

@@ -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