use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedRelationshipRepositoryAdapterTest method onClassWithoutSetRelationShouldThrowException.
@Test(expected = RepositoryAnnotationNotFoundException.class)
public void onClassWithoutSetRelationShouldThrowException() throws Exception {
// GIVEN
RelationshipRepositoryWithoutAnyMethods repo = new RelationshipRepositoryWithoutAnyMethods();
AnnotatedRelationshipRepositoryAdapter<Task, Long, Project, Long> sut = new AnnotatedRelationshipRepositoryAdapter<>(repo, parameterProvider);
// WHEN
sut.setRelation(new Task(), 1L, "project", queryAdapter);
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedRelationshipRepositoryAdapterTest method onClassWithSetRelationShouldSetValue.
@Test
public void onClassWithSetRelationShouldSetValue() throws Exception {
// GIVEN
RelationshipRepositoryWithSetRelation repo = spy(RelationshipRepositoryWithSetRelation.class);
AnnotatedRelationshipRepositoryAdapter<Task, Long, Project, Long> sut = new AnnotatedRelationshipRepositoryAdapter<>(repo, parameterProvider);
Task task = new Task();
// WHEN
sut.setRelation(task, 1L, "project", queryAdapter);
// THEN
verify(repo).setRelation(eq(task), eq(1L), eq("project"));
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedRelationshipRepositoryAdapterTest method onClassWithSetRelationsShouldSetValues.
@Test
public void onClassWithSetRelationsShouldSetValues() throws Exception {
// GIVEN
RelationshipRepositoryWithSetRelations repo = spy(RelationshipRepositoryWithSetRelations.class);
AnnotatedRelationshipRepositoryAdapter<Task, Long, Project, Long> sut = new AnnotatedRelationshipRepositoryAdapter<>(repo, parameterProvider);
Task task = new Task();
// WHEN
sut.setRelations(task, Collections.singleton(1L), "project", queryAdapter);
// THEN
verify(repo).setRelations(eq(task), eq(Collections.singleton(1L)), eq("project"));
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedRelationshipRepositoryAdapterTest method onClassWithoutRemoveRelationsShouldThrowException.
@Test(expected = RepositoryAnnotationNotFoundException.class)
public void onClassWithoutRemoveRelationsShouldThrowException() throws Exception {
// GIVEN
RelationshipRepositoryWithoutAnyMethods repo = new RelationshipRepositoryWithoutAnyMethods();
AnnotatedRelationshipRepositoryAdapter<Task, Long, Project, Long> sut = new AnnotatedRelationshipRepositoryAdapter<>(repo, parameterProvider);
// WHEN
sut.removeRelations(new Task(), Collections.singleton(1L), "project", queryAdapter);
}
use of io.crnk.core.mock.models.Project in project crnk-framework by crnk-project.
the class AnnotatedRelationshipRepositoryAdapterTest method onClassWithEmptyRemoveRelationsShouldThrowException.
@Test(expected = RepositoryMethodException.class)
public void onClassWithEmptyRemoveRelationsShouldThrowException() throws Exception {
// GIVEN
RelationshipRepositoryWithEmptyRemoveRelations repo = new RelationshipRepositoryWithEmptyRemoveRelations();
AnnotatedRelationshipRepositoryAdapter<Task, Long, Project, Long> sut = new AnnotatedRelationshipRepositoryAdapter<>(repo, parameterProvider);
// WHEN
sut.removeRelations(new Task(), Collections.singleton(1L), "project", queryAdapter);
}
Aggregations