1 package de.dlr.shepard.common.neo4j.entities;
2
3 import static org.junit.jupiter.api.Assertions.assertEquals;
4
5 import de.dlr.shepard.BaseTestCase;
6 import de.dlr.shepard.auth.users.entities.User;
7 import de.dlr.shepard.context.collection.entities.Collection;
8 import de.dlr.shepard.context.semantic.entities.SemanticAnnotation;
9 import java.util.List;
10 import nl.jqno.equalsverifier.EqualsVerifier;
11 import org.junit.jupiter.api.Test;
12
13 public class BasicEntityTest extends BaseTestCase {
14
15 @Test
16 public void equalsContract() {
17 EqualsVerifier.simple()
18 .forClass(BasicEntity.class)
19 .withPrefabValues(User.class, new User("bob"), new User("claus"))
20 .withPrefabValues(SemanticAnnotation.class, new SemanticAnnotation(1L), new SemanticAnnotation(2L))
21 .verify();
22 }
23
24 @Test
25 public void addAnnotationTest() {
26 var annotation2 = new SemanticAnnotation(2L);
27 var annotation3 = new SemanticAnnotation(3L);
28 var entity = new Collection(1L);
29 entity.addAnnotation(annotation2);
30 entity.addAnnotation(annotation3);
31 assertEquals(List.of(annotation2, annotation3), entity.getAnnotations());
32 }
33 }