View Javadoc
1   package com.github.jonasrutishauser.transactional.event.api.serialization;
2   
3   import static org.junit.jupiter.api.Assertions.*;
4   
5   import jakarta.annotation.Priority;
6   
7   import org.junit.jupiter.api.Test;
8   
9   class GenericSerializationTest {
10  
11      @Test
12      void testPriorityWithoutPriority() {
13          int priority = new WithoutPriority().priority();
14  
15          assertEquals(0, priority);
16      }
17  
18      @Test
19      void testPriorityWithPriority() {
20          int priority = new WithPriority().priority();
21  
22          assertEquals(42, priority);
23      }
24  
25      private static class WithoutPriority implements GenericSerialization {
26          @Override
27          public boolean accepts(Class<?> type) {
28              return fail("should not be called");
29          }
30  
31          @Override
32          public String serialize(Object event) {
33              return fail("should not be called");
34          }
35  
36          @Override
37          public <T> T deserialize(String event, Class<T> type) {
38              return fail("should not be called");
39          }
40      }
41  
42      @Priority(42)
43      private static class WithPriority extends WithoutPriority {}
44  
45  }