1

Merge branch 'event-db' into html-gruppe

This commit is contained in:
Talha Caliskan
2020-03-09 23:34:34 +01:00
committed by GitHub
4 changed files with 21 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package mops.gruppen2.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import mops.gruppen2.domain.event.AddUserEvent;
import mops.gruppen2.domain.event.Event;
import mops.gruppen2.repository.EventRepository;
import org.junit.jupiter.api.BeforeEach;
@ -9,15 +8,14 @@ import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
class SerializationServiceTest {
EventRepository eventRepository;
Event event;
@BeforeEach
public void setUp(){
public void setUp() {
}
@ -28,7 +26,9 @@ class SerializationServiceTest {
@Test
void serializeEventTest() {
event = new Event(1L,1L,"1");
SerializationService serializationService = new SerializationService(eventRepository);
try {
assertThat(serializationService.serializeEvent(event)).isEqualTo("{\"Event\":{\"event_id\":1,\"group_id\":1,\"user_id\":\"1\"}}");
@ -37,5 +37,15 @@ class SerializationServiceTest {
}
}
@Test
void deserializeAddUserEvent() throws JsonProcessingException {
SerializationService serializationService = new SerializationService(mock(EventRepository.class));
}
String json = "{\"type\":\"Event\",\"event_id\":1,\"group_id\":1,\"user_id\":\"1\"}";
Event event = serializationService.deserializeEvent(json);
assertThat(event).isInstanceOf(Event.class);
}
}