1

add test SerializationEvent test

This commit is contained in:
tomvahl
2020-03-09 15:52:55 +01:00
parent 1b1de974c6
commit 23cff2c3d3

View File

@ -1,16 +1,20 @@
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;
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.*;
class SerializationServiceTest {
EventRepository eventRepository;
Event event;
@BeforeEach
public void setUp(){
@ -23,10 +27,15 @@ class SerializationServiceTest {
}
@Test
void serializeEventTest(){
Event event = new Event(1,1,"1");
void serializeEventTest() {
event = new Event(1,1,"1");
SerializationService serializationService = new SerializationService(eventRepository);
try {
assertThat(serializationService.serializeEvent(event)).isEqualTo("{\"Event\":{\"event_id\":1,\"group_id\":1,\"user_id\":\"1\"}}");
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
}