Merge branch 'event-db' of /home/christoph/Documents/repos/abschlussprojekt-it-bois with conflicts.
This commit is contained in:
@ -53,7 +53,7 @@ public class SwaggerAPIControllerExample {
|
||||
return "Product saved successfully";
|
||||
}
|
||||
|
||||
/*@GetMapping("/json") //just for testing
|
||||
@GetMapping("/json")
|
||||
public void json() {
|
||||
AddUserEvent aEvent = new AddUserEvent(
|
||||
1,
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package mops.gruppen2.repository;
|
||||
|
||||
import mops.gruppen2.domain.EventDTO;
|
||||
import mops.gruppen2.domain.event.Event;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface EventRepository extends CrudRepository<EventDTO, Long> {
|
||||
|
||||
@ -41,4 +41,10 @@ public class SerializationService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Event deserializeEvent(String json) throws JsonProcessingException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Event event = mapper.readValue(json, Event.class);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -14,10 +13,9 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
class SerializationServiceTest {
|
||||
|
||||
EventRepository eventRepository;
|
||||
Event event;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(){
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +26,7 @@ class SerializationServiceTest {
|
||||
|
||||
@Test
|
||||
void serializeEventTest() {
|
||||
event = new Event(1,1,"1");
|
||||
Event 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\"}}");
|
||||
@ -37,5 +35,12 @@ class SerializationServiceTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void deserializeAddUserEvent() {
|
||||
SerializationService serializationService = new SerializationService();
|
||||
|
||||
Event event = EventBuilder.randomAddUserEvent();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user