📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@@ -23,12 +23,12 @@
|
||||
|
||||
package com.iluwatar.observer;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -36,10 +36,10 @@ public class HobbitsTest extends WeatherObserverTest<Hobbits> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The hobbits are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are facing Cold weather now"});
|
||||
new Object[]{WeatherType.SUNNY, "The hobbits are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are facing Cold weather now"});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,10 +36,10 @@ public class OrcsTest extends WeatherObserverTest<Orcs> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The orcs are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The orcs are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The orcs are facing Cold weather now"});
|
||||
new Object[]{WeatherType.SUNNY, "The orcs are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The orcs are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The orcs are facing Cold weather now"});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
|
||||
package com.iluwatar.observer;
|
||||
|
||||
import com.iluwatar.observer.utils.InMemoryAppender;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InOrder;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -36,6 +30,11 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import com.iluwatar.observer.utils.InMemoryAppender;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 11:08 AM
|
||||
*
|
||||
@@ -60,7 +59,7 @@ public class WeatherTest {
|
||||
* observer again and verify that there are no more notifications.
|
||||
*/
|
||||
@Test
|
||||
public void testAddRemoveObserver() {
|
||||
void testAddRemoveObserver() {
|
||||
final var observer = mock(WeatherObserver.class);
|
||||
|
||||
final var weather = new Weather();
|
||||
@@ -83,7 +82,7 @@ public class WeatherTest {
|
||||
* Verify if the weather passes in the order of the {@link WeatherType}s
|
||||
*/
|
||||
@Test
|
||||
public void testTimePasses() {
|
||||
void testTimePasses() {
|
||||
final var observer = mock(WeatherObserver.class);
|
||||
final var weather = new Weather();
|
||||
weather.addObserver(observer);
|
||||
|
||||
@@ -38,10 +38,10 @@ public class GHobbitsTest extends ObserverTest<GHobbits> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The hobbits are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are facing Cold weather now"}
|
||||
new Object[]{WeatherType.SUNNY, "The hobbits are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are facing Cold weather now"}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,16 +23,19 @@
|
||||
|
||||
package com.iluwatar.observer.generic;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import com.iluwatar.observer.WeatherObserver;
|
||||
import com.iluwatar.observer.WeatherType;
|
||||
import com.iluwatar.observer.utils.InMemoryAppender;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InOrder;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 11:08 AM
|
||||
@@ -58,7 +61,7 @@ public class GWeatherTest {
|
||||
* observer again and verify that there are no more notifications.
|
||||
*/
|
||||
@Test
|
||||
public void testAddRemoveObserver() {
|
||||
void testAddRemoveObserver() {
|
||||
final var observer = mock(Race.class);
|
||||
|
||||
final var weather = new GWeather();
|
||||
@@ -81,7 +84,7 @@ public class GWeatherTest {
|
||||
* Verify if the weather passes in the order of the {@link WeatherType}s
|
||||
*/
|
||||
@Test
|
||||
public void testTimePasses() {
|
||||
void testTimePasses() {
|
||||
final var observer = mock(Race.class);
|
||||
final var weather = new GWeather();
|
||||
weather.addObserver(observer);
|
||||
|
||||
@@ -38,10 +38,10 @@ public class OrcsTest extends ObserverTest<GOrcs> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The orcs are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The orcs are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The orcs are facing Cold weather now"}
|
||||
new Object[]{WeatherType.SUNNY, "The orcs are facing Sunny weather now"},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are facing Rainy weather now"},
|
||||
new Object[]{WeatherType.WINDY, "The orcs are facing Windy weather now"},
|
||||
new Object[]{WeatherType.COLD, "The orcs are facing Cold weather now"}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user