Add missing effects
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -5,10 +5,24 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class EffectTest {
|
||||
private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper
|
||||
|
||||
@Test
|
||||
public void getById() {
|
||||
for (Effect effect : Effect.values()) {
|
||||
if (!isDeprecated(effect)) // Paper
|
||||
assertThat(Effect.getById(effect.getId()), is(effect));
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
private static boolean isDeprecated(Effect effect) {
|
||||
try {
|
||||
return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class);
|
||||
} catch (NoSuchFieldException e) {
|
||||
LOGGER.error("Error getting effect enum field {}", effect.name(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user