Use enums instead os switch blocks
Its better to use enums instead of switch blocks which makes the code longer and difficult to maintain as and when new state appears.
This commit is contained in:
@@ -36,10 +36,10 @@ public class HobbitsTest extends WeatherObserverTest<Hobbits> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."});
|
||||
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 sun hurts the orcs' eyes."},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are dripping wet."},
|
||||
new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."},
|
||||
new Object[]{WeatherType.COLD, "The orcs are freezing cold."});
|
||||
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"});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,10 +38,10 @@ public class GHobbitsTest extends ObserverTest<GHobbits> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."},
|
||||
new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."},
|
||||
new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."},
|
||||
new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."}
|
||||
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"}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ public class OrcsTest extends ObserverTest<GOrcs> {
|
||||
@Override
|
||||
public Collection<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."},
|
||||
new Object[]{WeatherType.RAINY, "The orcs are dripping wet."},
|
||||
new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."},
|
||||
new Object[]{WeatherType.COLD, "The orcs are freezing cold."}
|
||||
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