test: Remove auto transient test
This commit is contained in:
@ -1,34 +0,0 @@
|
|||||||
package cz.jzitnik.game.core.autotransient;
|
|
||||||
|
|
||||||
import cz.jzitnik.game.annotations.AutoTransient;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.reflections.Reflections;
|
|
||||||
import org.reflections.scanners.Scanners;
|
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
class AutoTransientSupportTest {
|
|
||||||
@Test
|
|
||||||
@DisplayName("All fields annotated with @AutoTransient must be transient.")
|
|
||||||
void checkAutoTransientAnnotation() {
|
|
||||||
Reflections reflections = new Reflections(
|
|
||||||
new ConfigurationBuilder()
|
|
||||||
.forPackages("cz.jzitnik.game")
|
|
||||||
.addScanners(Scanners.FieldsAnnotated)
|
|
||||||
);
|
|
||||||
Set<Field> fields = reflections.getFieldsAnnotatedWith(AutoTransient.class);
|
|
||||||
|
|
||||||
for (Field field : fields) {
|
|
||||||
if (!Modifier.isTransient(field.getModifiers())) {
|
|
||||||
fail("Field '" + field.getName() + "' in class " + field.getClass().getName() +
|
|
||||||
" is annotated with @AutoTransient but is not transient.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user