2 * This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at https://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
8 package wtf
.metio
.yosql
.models
.configuration
;
10 import org
.junit
.jupiter
.api
.Test
;
12 import java
.util
.List
;
14 import static org
.junit
.jupiter
.api
.Assertions
.assertIterableEquals
;
16 class AnnotationTest
{
19 void mergeAnnotationsFirst() {
20 final List
<Annotation
> first
= List
.of(Annotation
.builder().setType("com.example.MyAnnotation").build());
21 final List
<Annotation
> second
= List
.of();
23 final var merged
= Annotation
.mergeAnnotations(first
, second
);
25 assertIterableEquals(first
, merged
);
29 void mergeAnnotationsSecond() {
30 final List
<Annotation
> first
= List
.of();
31 final List
<Annotation
> second
= List
.of(Annotation
.builder().setType("com.example.MyAnnotation").build());
33 final var merged
= Annotation
.mergeAnnotations(first
, second
);
35 assertIterableEquals(second
, merged
);
39 void mergeAnnotationsDuplicates() {
40 final List
<Annotation
> first
= List
.of(Annotation
.builder().setType("com.example.MyAnnotation").build());
41 final List
<Annotation
> second
= List
.of(Annotation
.builder().setType("com.example.MyAnnotation").build());
43 final var merged
= Annotation
.mergeAnnotations(first
, second
);
45 assertIterableEquals(first
, merged
);
46 assertIterableEquals(second
, merged
);
50 void mergeAnnotationsWithMembersFirst() {
51 final List
<Annotation
> first
= List
.of(Annotation
.builder()
52 .setType("com.example.MyAnnotation")
53 .addMembers(AnnotationMember
.builder().setKey("value").setValue("some").build())
55 final List
<Annotation
> second
= List
.of(Annotation
.builder()
56 .setType("com.example.MyAnnotation")
59 final var merged
= Annotation
.mergeAnnotations(first
, second
);
61 assertIterableEquals(first
, merged
);
65 void mergeAnnotationsWithMembersSecond() {
66 final List
<Annotation
> first
= List
.of(Annotation
.builder()
67 .setType("com.example.MyAnnotation")
69 final List
<Annotation
> second
= List
.of(Annotation
.builder()
70 .setType("com.example.MyAnnotation")
71 .addMembers(AnnotationMember
.builder().setKey("value").setValue("some").build())
74 final var merged
= Annotation
.mergeAnnotations(first
, second
);
76 assertIterableEquals(second
, merged
);