Add missing effects

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Ivan Pekov
2021-01-05 10:19:11 +02:00
parent eb0e3a82b8
commit 80b653d06f
2 changed files with 156 additions and 12 deletions

View File

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