1 package de.dlr.shepard.context.version.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 VersionableEntityTest extends BaseTestCase {
14
15 @Test
16 public void equalsContract() {
17 EqualsVerifier.simple()
18 .forClass(VersionableEntity.class)
19 .withPrefabValues(User.class, new User("bob"), new User("claus"))
20 .withPrefabValues(Version.class, new Version("Version1"), new Version("Version2"))
21 .withPrefabValues(SemanticAnnotation.class, new SemanticAnnotation(1L), new SemanticAnnotation(2L))
22 .verify();
23 }
24
25 @Test
26 public void addAnnotationTest() {
27 var annotation2 = new SemanticAnnotation(2L);
28 var annotation3 = new SemanticAnnotation(3L);
29 var entity = new Collection(1L);
30 entity.addAnnotation(annotation2);
31 entity.addAnnotation(annotation3);
32 assertEquals(List.of(annotation2, annotation3), entity.getAnnotations());
33 }
34 }