Skip to content

Commit

Permalink
#813 - tests compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Nov 1, 2024
1 parent 054b8b4 commit 3b907db
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class SubjectMigrationIntegrationTest extends AbstractControllerIntegrati

private List<SubjectMigration> getMigrations(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now) {
CollectionModel<EntityModel<SubjectMigration>> migrations = subjectMigrationController.getMigrationsByCatchmentAndLastModified(lastModifiedDateTime, now, subjectType.getUuid(), PageRequest.of(0, 10));
return migrations.getContent().stream().map(Resource::getContent).collect(Collectors.toList());
return migrations.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList());
}

private boolean hasMigrationFor(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now, Individual subject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FormElementRepositoryTest extends AbstractControllerIntegrationTest
@Before
public void setUp() throws Exception {
super.setUp();
pageRequest = new PageRequest(0, 100);
pageRequest = PageRequest.of(0, 100);
setUser("demo-admin");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.avni.server.service.builder.TestLocationService;
import org.avni.server.service.builder.TestSubjectTypeService;
import org.junit.Test;
import org.springframework.batch.item.Chunk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;

Expand Down Expand Up @@ -96,7 +97,7 @@ private String[] has(String... errors) {
private void success(String[] headers, String[] cells, boolean catchmentCreated, boolean userCreated) throws IDPException {
long numberOfUsers = userRepository.count();
long numberOfCatchments = catchmentRepository.count();
userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, cells)));
userAndCatchmentWriter.write(Chunk.of(new Row(headers, cells)));
if (catchmentCreated)
assertEquals(catchmentRepository.count(), numberOfCatchments + 1);
else
Expand All @@ -109,7 +110,7 @@ private void success(String[] headers, String[] cells, boolean catchmentCreated,

private void failure(String[] headers, String[] cells, String[] errorMessages) throws IDPException {
try {
userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, cells)));
userAndCatchmentWriter.write(Chunk.of(new Row(headers, cells)));
fail();
} catch (RuntimeException e) {
String message = e.getMessage();
Expand All @@ -129,7 +130,7 @@ private void failure(String[] headers, String[] cells, String[] errorMessages) t

private void failsOnMissingHeader(String[] headers, String[] errorMessages, String... nonExistentErrorMessages) throws IDPException {
try {
userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, new String[]{})));
userAndCatchmentWriter.write(Chunk.of(new Row(headers, new String[]{})));
fail();
} catch (RuntimeException e) {
String message = e.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public List<Individual> getSubjects(SubjectType subjectType, DateTime lastModifi

public List<Individual> getSubjects(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now) {
CollectionModel<EntityModel<Individual>> individuals = individualController.getIndividualsByOperatingIndividualScope(lastModifiedDateTime, now, subjectType.getUuid(), PageRequest.of(0, 10));
return individuals.getContent().stream().map(Resource::getContent).collect(Collectors.toList());
return individuals.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList());
}

public List<ProgramEnrolment> getEnrolments(Program program) throws Exception {
Expand All @@ -59,6 +59,6 @@ public List<ProgramEnrolment> getEnrolments(Program program, DateTime lastModifi

public List<ProgramEnrolment> getEnrolments(Program program, DateTime lastModifiedDateTime, DateTime now) throws Exception {
CollectionModel<EntityModel<ProgramEnrolment>> enrolments = programEnrolmentController.getProgramEnrolmentsByOperatingIndividualScope(lastModifiedDateTime, now, program.getUuid(), PageRequest.of(0, 10));
return enrolments.getContent().stream().map(Resource::getContent).collect(Collectors.toList());
return enrolments.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void setUp() throws Exception {

@Test
public void findByEntityId() {
Page<FormMapping> fmPage = formMappingRepository.findByProgramId(1L, new PageRequest(0, 1));
Page<FormMapping> fmPage = formMappingRepository.findByProgramId(1L, PageRequest.of(0, 1));
assertEquals(1, fmPage.getContent().size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,6 @@ private List<GroupSubject> getGroupSubjects(SubjectType groupSubjectType, DateTi
CollectionModel<EntityModel<GroupSubject>> enrolments = groupSubjectController.getGroupSubjectsByOperatingIndividualScope(lastModifiedDateTime, now,
groupSubjectType.getUuid(),
PageRequest.of(0, 10));
return enrolments.getContent().stream().map(Resource::getContent).collect(Collectors.toList());
return enrolments.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList());
}
}

0 comments on commit 3b907db

Please sign in to comment.