use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class PackageRepositoryValidationDecoratorTest method testUpdateValid.
@Test
public void testUpdateValid() throws Exception {
Package package_ = mock(Package.class);
packageRepositoryValidationDecorator.update(package_);
verify(packageValidator).validate(package_);
verify(delegateRepository).update(package_);
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class PackageRepositoryValidationDecoratorTest method testDeleteByIdValid.
@Test
public void testDeleteByIdValid() throws Exception {
Package package_ = mock(Package.class);
Object id = mock(Object.class);
when(delegateRepository.findOneById(id)).thenReturn(package_);
packageRepositoryValidationDecorator.deleteById(id);
verify(packageValidator).validate(package_);
verify(delegateRepository).deleteById(id);
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class PackageRepositoryValidationDecoratorTest method testDeleteAllStreamValid.
@SuppressWarnings("ResultOfMethodCallIgnored")
@Test
public void testDeleteAllStreamValid() throws Exception {
Package package_ = mock(Package.class);
Object id = mock(Object.class);
when(delegateRepository.findOneById(id)).thenReturn(package_);
packageRepositoryValidationDecorator.deleteAll(Stream.of(id));
@SuppressWarnings("unchecked") ArgumentCaptor<Stream<Object>> packageIdCaptor = ArgumentCaptor.forClass(Stream.class);
verify(delegateRepository).deleteAll(packageIdCaptor.capture());
packageIdCaptor.getValue().count();
verify(packageValidator).validate(package_);
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class PackageRepositoryValidationDecoratorTest method testDeleteByIdInvalid.
@Test(expectedExceptions = MolgenisValidationException.class)
public void testDeleteByIdInvalid() throws Exception {
Package package_ = mock(Package.class);
Object id = mock(Object.class);
when(delegateRepository.findOneById(id)).thenReturn(package_);
doThrow(mock(MolgenisValidationException.class)).when(packageValidator).validate(package_);
packageRepositoryValidationDecorator.deleteById(id);
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class PackageRepositoryValidationDecoratorTest method testUpdateStreamInvalid.
@SuppressWarnings("ResultOfMethodCallIgnored")
@Test(expectedExceptions = MolgenisValidationException.class)
public void testUpdateStreamInvalid() throws Exception {
Package package_ = mock(Package.class);
doThrow(mock(MolgenisValidationException.class)).when(packageValidator).validate(package_);
packageRepositoryValidationDecorator.update(Stream.of(package_));
@SuppressWarnings("unchecked") ArgumentCaptor<Stream<Package>> packageCaptor = ArgumentCaptor.forClass(Stream.class);
verify(delegateRepository).update(packageCaptor.capture());
packageCaptor.getValue().count();
}
Aggregations