Merge branch 'event-db' of /home/christoph/Documents/repos/abschlussprojekt-it-bois with conflicts.
This commit is contained in:
@ -52,8 +52,8 @@ public class SwaggerAPIControllerExample {
|
||||
|
||||
return "Product saved successfully";
|
||||
}
|
||||
/*
|
||||
@GetMapping("/json")
|
||||
|
||||
/*@GetMapping("/json")
|
||||
public void json() {
|
||||
AddUserEvent aEvent = new AddUserEvent(
|
||||
1,
|
||||
|
||||
@ -24,9 +24,7 @@ public class SerializationService {
|
||||
|
||||
public String serializeEvent(Event event) throws JsonProcessingException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String json = mapper.writeValueAsString(event);
|
||||
log.info(json);
|
||||
return json;
|
||||
return mapper.writeValueAsString(event);
|
||||
}
|
||||
|
||||
public void saveEvent(Event event){
|
||||
@ -44,7 +42,6 @@ public class SerializationService {
|
||||
|
||||
public Event deserializeEvent(String json) throws JsonProcessingException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Event event = mapper.readValue(json, Event.class);
|
||||
return event;
|
||||
return mapper.readValue(json, Event.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package mops.gruppen2.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import mops.gruppen2.builder.EventBuilder;
|
||||
import mops.gruppen2.domain.event.AddUserEvent;
|
||||
import mops.gruppen2.domain.event.Event;
|
||||
import mops.gruppen2.repository.EventRepository;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -11,15 +9,13 @@ 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() {
|
||||
}
|
||||
|
||||
|
||||
@ -40,11 +36,14 @@ class SerializationServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void deserializeAddUserEvent() {
|
||||
void deserializeAddUserEvent() throws JsonProcessingException {
|
||||
SerializationService serializationService = new SerializationService(mock(EventRepository.class));
|
||||
|
||||
Event event = EventBuilder.randomAddUserEvent();
|
||||
String json = "{\"type\":\"Event\",\"event_id\":1,\"group_id\":1,\"user_id\":\"1\"}";
|
||||
|
||||
Event event = serializationService.deserializeEvent(json);
|
||||
|
||||
assertThat(event).isInstanceOf(Event.class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user