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:
@ -41,6 +41,6 @@ public class CakeViewImpl implements View {
|
||||
}
|
||||
|
||||
public void render() {
|
||||
cakeBakingService.getAllCakes().stream().forEach(cake -> LOGGER.info(cake.toString()));
|
||||
cakeBakingService.getAllCakes().forEach(cake -> LOGGER.info(cake.toString()));
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
public class CakeBakingExceptionTest {
|
||||
|
||||
@Test
|
||||
public void testConstructor() throws Exception {
|
||||
public void testConstructor() {
|
||||
final CakeBakingException exception = new CakeBakingException();
|
||||
assertNull(exception.getMessage());
|
||||
assertNull(exception.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructorWithMessage() throws Exception {
|
||||
public void testConstructorWithMessage() {
|
||||
final String expectedMessage = "message";
|
||||
final CakeBakingException exception = new CakeBakingException(expectedMessage);
|
||||
assertEquals(expectedMessage, exception.getMessage());
|
||||
|
@ -42,7 +42,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
public class CakeBakingServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void testLayers() throws CakeBakingException {
|
||||
public void testLayers() {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
final List<CakeLayerInfo> initialLayers = service.getAvailableLayers();
|
||||
@ -65,7 +65,7 @@ public class CakeBakingServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToppings() throws CakeBakingException {
|
||||
public void testToppings() {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
final List<CakeToppingInfo> initialToppings = service.getAvailableToppings();
|
||||
@ -125,7 +125,7 @@ public class CakeBakingServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBakeCakeMissingTopping() throws CakeBakingException {
|
||||
public void testBakeCakeMissingTopping() {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
final CakeLayerInfo layer1 = new CakeLayerInfo("Layer1", 1000);
|
||||
@ -140,7 +140,7 @@ public class CakeBakingServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBakeCakeMissingLayer() throws CakeBakingException {
|
||||
public void testBakeCakeMissingLayer() {
|
||||
final CakeBakingServiceImpl service = new CakeBakingServiceImpl();
|
||||
|
||||
final List<CakeInfo> initialCakes = service.getAllCakes();
|
||||
|
@ -44,7 +44,7 @@ public class CakeTest {
|
||||
final Cake cake = new Cake();
|
||||
assertNull(cake.getId());
|
||||
|
||||
final Long expectedId = Long.valueOf(1234L);
|
||||
final Long expectedId = 1234L;
|
||||
cake.setId(expectedId);
|
||||
assertEquals(expectedId, cake.getId());
|
||||
}
|
||||
|
Reference in New Issue
Block a user