use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class RepositoryAdapterTest method onClassWithGetMetaInformationShouldInvokeMethod.
@Test
public void onClassWithGetMetaInformationShouldInvokeMethod() throws Exception {
// GIVEN
ResourceRepositoryWithGetMetaInformation repo = spy(ResourceRepositoryWithGetMetaInformation.class);
AnnotatedResourceRepositoryAdapter<Project, Long> sut = new AnnotatedResourceRepositoryAdapter<>(repo, parameterFactory);
List<Project> resources = Collections.singletonList(new Project());
// WHEN
sut.getMetaInformation(resources, queryAdapter);
// THEN
verify(repo).getMetaInformation(resources, queryParams, "");
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class TaskToProjectRepository method findOneTarget.
@Override
public Project findOneTarget(Long sourceId, String fieldName, QueryParams queryParams) {
Map<Relation<Task>, Integer> repo = getRepo();
for (Relation<Task> relation : repo.keySet()) {
if (relation.getSource().getId().equals(sourceId) && relation.getFieldName().equals(fieldName)) {
Project project = new Project();
if (relation.getTargetId().equals(ProjectRepository.FANCY_PROJECT_ID)) {
project = new FancyProject();
}
project.setId((Long) relation.getTargetId());
return project;
}
}
return null;
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedResourceRepositoryAdapterTest method onClassWithoutSaveShouldThrowException.
@Test(expected = RepositoryAnnotationNotFoundException.class)
public void onClassWithoutSaveShouldThrowException() throws Exception {
// GIVEN
ResourceRepositoryWithoutAnyMethods repo = new ResourceRepositoryWithoutAnyMethods();
AnnotatedResourceRepositoryAdapter<Project, Long> sut = new AnnotatedResourceRepositoryAdapter<>(repo, parameterProvider);
// WHEN
sut.save(new Project());
}
Aggregations