1

adapt tests

Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
Christoph
2020-03-18 21:45:33 +01:00
parent 79de4a8540
commit e1a630ae1a
4 changed files with 6 additions and 36 deletions

View File

@ -42,7 +42,7 @@ public class EventService {
public EventDTO getDTO(Event event) { public EventDTO getDTO(Event event) {
boolean visibility = false; boolean visibility = false;
if (event instanceof CreateGroupEvent) { if (event instanceof CreateGroupEvent) {
visibility = ((CreateGroupEvent) event).getGroupVisibility() == Visibility.PRIVATE; visibility = ((CreateGroupEvent) event).getGroupVisibility() == Visibility.PUBLIC;
} }
String payload = ""; String payload = "";

View File

@ -2,7 +2,6 @@ package mops.gruppen2.architecture;
import com.tngtech.archunit.core.importer.ImportOption; import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchIgnore;
import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule; import com.tngtech.archunit.lang.ArchRule;
@ -30,11 +29,11 @@ public class DomainTest {
@ArchTest @ArchTest
public static final ArchRule exceptionClassesShouldBeInExceptionPackage = classes() public static final ArchRule exceptionClassesShouldBeInExceptionPackage = classes()
.that().haveSimpleNameEndingWith("Exception") .that().haveSimpleNameEndingWith("Exception")
.should().resideInAPackage("..domain.Exceptions.."); .should().resideInAPackage("..domain.exception..");
@ArchTest @ArchTest
public static final ArchRule classesInExceptionPackageShouldHaveExceptionInName = classes() public static final ArchRule classesInExceptionPackageShouldHaveExceptionInName = classes()
.that().resideInAPackage("..domain.Exceptions..") .that().resideInAPackage("..domain.exception..")
.should().haveSimpleNameEndingWith("Exception"); .should().haveSimpleNameEndingWith("Exception");
@ArchTest @ArchTest

View File

@ -20,8 +20,9 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
class EventServiceTest { class EventServiceTest {
EventService eventService;
EventRepository eventRepositoryMock = mock(EventRepository.class); private EventService eventService;
private EventRepository eventRepositoryMock = mock(EventRepository.class);
@BeforeEach @BeforeEach
void setUp() { void setUp() {

View File

@ -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\"}");
}
}