Skip to content

Commit

Permalink
test: missing entity classes and non-jsonapi entities
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceh121 committed Nov 1, 2023
1 parent 8084aef commit 7bf1e6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import me.vinceh121.jskolengo.entities.SkoAppConfig;
import me.vinceh121.jskolengo.entities.StudentUserInfo;
import me.vinceh121.jskolengo.entities.agenda.Agenda;
import me.vinceh121.jskolengo.entities.agenda.Audio;
import me.vinceh121.jskolengo.entities.agenda.CorrectedWork;
import me.vinceh121.jskolengo.entities.agenda.Homework;
import me.vinceh121.jskolengo.entities.agenda.Lesson;
import me.vinceh121.jskolengo.entities.agenda.LessonContent;
Expand Down Expand Up @@ -38,6 +40,8 @@ public final class SkolengoConstants {
SkoAppConfig.class,
StudentUserInfo.class,
Agenda.class,
Audio.class,
CorrectedWork.class,
Homework.class,
Lesson.class,
LessonContent.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.reflections.Reflections;
import org.reflections.scanners.Scanners;

import com.github.jasminb.jsonapi.annotations.Type;

import me.vinceh121.jskolengo.SkolengoConstants;
import me.vinceh121.jskolengo.entities.AbstractSkolengoEntity;

Expand All @@ -19,8 +22,12 @@ class TestMapper {
void testClassList() {
Reflections ref = new Reflections("me.vinceh121.jskolengo.entities", Scanners.SubTypes);
List<Class<? extends AbstractSkolengoEntity>> expected
= new ArrayList<>(ref.getSubTypesOf(AbstractSkolengoEntity.class));
= new ArrayList<>(ref.getSubTypesOf(AbstractSkolengoEntity.class)).stream()
.filter(c -> c.isAnnotationPresent(Type.class))
.collect(Collectors.toList());

List<Class<? extends AbstractSkolengoEntity>> actual = new ArrayList<>();

for (Class<?> o : SkolengoConstants.ENTITY_CLASSES) {
actual.add((Class<? extends AbstractSkolengoEntity>) o);
}
Expand Down

0 comments on commit 7bf1e6c

Please sign in to comment.