@ -42,7 +42,7 @@ public class EventService {
|
||||
public EventDTO getDTO(Event event) {
|
||||
boolean visibility = false;
|
||||
if (event instanceof CreateGroupEvent) {
|
||||
visibility = ((CreateGroupEvent) event).getGroupVisibility() == Visibility.PRIVATE;
|
||||
visibility = ((CreateGroupEvent) event).getGroupVisibility() == Visibility.PUBLIC;
|
||||
}
|
||||
|
||||
String payload = "";
|
||||
|
||||
@ -2,7 +2,6 @@ package mops.gruppen2.architecture;
|
||||
|
||||
import com.tngtech.archunit.core.importer.ImportOption;
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchIgnore;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
|
||||
@ -30,11 +29,11 @@ public class DomainTest {
|
||||
@ArchTest
|
||||
public static final ArchRule exceptionClassesShouldBeInExceptionPackage = classes()
|
||||
.that().haveSimpleNameEndingWith("Exception")
|
||||
.should().resideInAPackage("..domain.Exceptions..");
|
||||
.should().resideInAPackage("..domain.exception..");
|
||||
|
||||
@ArchTest
|
||||
public static final ArchRule classesInExceptionPackageShouldHaveExceptionInName = classes()
|
||||
.that().resideInAPackage("..domain.Exceptions..")
|
||||
.that().resideInAPackage("..domain.exception..")
|
||||
.should().haveSimpleNameEndingWith("Exception");
|
||||
|
||||
@ArchTest
|
||||
|
||||
@ -20,8 +20,9 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
class EventServiceTest {
|
||||
EventService eventService;
|
||||
EventRepository eventRepositoryMock = mock(EventRepository.class);
|
||||
|
||||
private EventService eventService;
|
||||
private EventRepository eventRepositoryMock = mock(EventRepository.class);
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
package mops.gruppen2.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import mops.gruppen2.domain.Role;
|
||||
import mops.gruppen2.domain.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.mockito.Mockito.mock;
|
||||
|
||||
class SerializationServiceTest {
|
||||
|
||||
SerializationService serializationService;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
serializationService = new SerializationService(mock(EventRepository.class));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void serializeEventTest() throws JsonProcessingException {
|
||||
Event event = new Event(1L,"1");
|
||||
|
||||
assertThat(serializationService.serializeEvent(event)).isEqualTo("{\"type\":\"Event\",\"group_id\":1,\"user_id\":\"1\"}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user