package com.pollistics.services;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.pollistics.PollisticsApplication;
import com.pollistics.models.Poll;
import com.pollistics.repositories.PollRepository;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = PollisticsApplication.class)
public class PollServiceTests {
	@Autowired
	private PollRepository pollRepo;

	@Autowired
	private PollService pollService;

	@Test
	public void getPollByIdTest() {
		Poll poll = pollRepo.findAll().get(0);
		Poll pollById = pollService.getPoll(poll.getId().toString());

		assertThat(poll.equals(pollById));
	}

	@Test
	public void getAllPollsTest() {
		assertThat(pollService.getAllPolls() != null);
		assertThat(pollService.getAllPolls().get(0) != null);
		assertThat(pollService.getAllPolls().equals(pollRepo.findAll()));
	}
}

@@ -815,17 +815,16 @@
 ing());%0A
-%0A
 %09%09assert
@@ -993,32 +993,32 @@
 et(0) != null);%0A
-
 %09%09assertThat(pol
@@ -1072,10 +1072,295 @@
 )));%0A%09%7D%0A
+%09%0A%09@Test%0A%09public void createPollTest() %7B%0A%09%09Poll poll = pollRepo.findAll().get(0);%0A%09%09String id = pollService.createPoll(poll.getName(), poll.getOptions());%0A%09%09assertThat(id instanceof String);%0A%09%09%0A%09%09Poll pollById = pollService.getPoll(id);%0A%09%09assertThat(id.equals(pollById.getId()));%09%09%0A%09%7D%0A
 %7D%0A

Add service tests