Compare commits

..

No commits in common. '553e2b1551bc2441ae16a6cf0e3d84525e11f1d0' and 'b020eb3a628328a61b398aede8eb4ca3e8855e44' have entirely different histories.

  1. 10
      src/main/java/de/kreth/clubhelper/model/controller/AttendanceController.java
  2. 8
      src/main/java/de/kreth/clubhelper/model/data/CompetitionType.java
  3. 23
      src/test/java/de/kreth/clubhelper/model/PersonControllerTest.java
  4. 0
      src/test/resources/data.sql
  5. 0
      src/test/resources/schema.sql

@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.kreth.clubhelper.model.dao.AttendanceDao;
import de.kreth.clubhelper.model.dao.PersonDao;
import de.kreth.clubhelper.model.data.Attendance;
@ -37,6 +40,13 @@ public class AttendanceController {
@ResponseBody
public List<Attendance> getAttendencesOn(@PathVariable("date") @DateTimeFormat(iso = ISO.DATE) LocalDate date) {
List<Attendance> findByOnDate = attendanceDao.findByOnDate(date);
ObjectMapper mapper = new ObjectMapper();
try {
String one = mapper.writeValueAsString(findByOnDate.get(0));
System.out.println(one);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return findByOnDate;
}

@ -14,8 +14,6 @@ import javax.persistence.Table;
@Table(name = "clubevent_addon")
public class CompetitionType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
@ -88,14 +86,16 @@ public class CompetitionType implements Serializable {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
}
else if (!id.equals(other.id)) {
return false;
}
if (type == null) {
if (other.type != null) {
return false;
}
} else if (!type.equals(other.type)) {
}
else if (!type.equals(other.type)) {
return false;
}
return true;

@ -10,7 +10,6 @@ import java.util.Arrays;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration;
@ -27,15 +26,16 @@ import de.kreth.clubhelper.model.dao.PersonDao;
import de.kreth.clubhelper.model.data.Gender;
import de.kreth.clubhelper.model.data.Person;
@WebMvcTest(excludeAutoConfiguration = {
@WebMvcTest(excludeAutoConfiguration =
{
DataSourceAutoConfiguration.class,
JdbcRepositoriesAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
JdbcTemplateAutoConfiguration.class,
SecurityAutoConfiguration.class
})
@Disabled
class PersonControllerTest {
class PersonControllerTest
{
@Autowired
MockMvc mvc;
@ -46,7 +46,8 @@ class PersonControllerTest {
private Person p2;
@BeforeEach
void initMocks() {
void initMocks()
{
p1 = new Person();
p1.setId(1);
p1.setPrename("prename");
@ -65,18 +66,18 @@ class PersonControllerTest {
}
@Test
void callAllPersons() throws Exception {
void callAllPersons() throws Exception
{
String jsonListOfPersons = "[{\"id\":1,\"changed\":null,\"created\":null,\"deleted\":null,\"birth\":\"2000-01-01\",\"prename\":\"prename\",\"surname\":\"surname\",\"username\":null,\"password\":null,\"gender\":\"MALE\"},{\"id\":1,\"changed\":null,\"created\":null,\"deleted\":null,\"birth\":\"2000-01-01\",\"prename\":\"prename\",\"surname\":\"surname\",\"username\":null,\"password\":null,\"gender\":\"MALE\"}]";
mvc.perform(get("/person").accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML))
.andExpect(status().isOk())
mvc.perform(get("/person").accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)).andExpect(status().isOk())
.andExpect(content().string(jsonListOfPersons));
}
@Test
void callPerson1() throws Exception {
void callPerson1() throws Exception
{
String jsonListOfPersons = "{\"id\":1,\"changed\":null,\"created\":null,\"deleted\":null,\"birth\":\"2000-01-01\",\"prename\":\"prename\",\"surname\":\"surname\",\"username\":null,\"password\":null,\"gender\":\"MALE\"}";
mvc.perform(get("/person/1").accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML))
.andExpect(status().isOk())
mvc.perform(get("/person/1").accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)).andExpect(status().isOk())
.andExpect(content().string(jsonListOfPersons));
}
}

Loading…
Cancel
Save