add readme

This commit is contained in:
Stepan Usatiuk
2024-01-04 18:16:51 +01:00
parent 50cc02351d
commit d5867a7877
3 changed files with 24 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import com.usatiuk.tjv.y.server.dto.PersonCreateTo;
import com.usatiuk.tjv.y.server.dto.converters.PersonMapper;
import com.usatiuk.tjv.y.server.entity.Person;
import com.usatiuk.tjv.y.server.repository.PersonRepository;
import jakarta.persistence.EntityNotFoundException;
import org.junit.jupiter.api.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -78,6 +79,18 @@ public class PersonServiceImplIntegrationTest {
Assertions.assertIterableEquals(List.of(personMapper.makeDto(person2)), personService.getFollowing(auth));
}
@Test
@WithUserDetails(value = "person1", setupBefore = TestExecutionEvent.TEST_EXECUTION)
void shouldAddFollowingThrows() {
var auth = SecurityContextHolder.getContext().getAuthentication();
Assertions.assertEquals(0, personService.getFollowing(auth).size());
Assertions.assertThrows(EntityNotFoundException.class, () -> {
personService.addFollower(auth, "asdfasdf");
});
Assertions.assertEquals(0, personService.getFollowing(auth).size());
}
@Test
@WithUserDetails(value = "person2", setupBefore = TestExecutionEvent.TEST_EXECUTION)
void shouldRemoveFollowing() {