use of org.molgenis.data.meta.model.Tag in project molgenis by molgenis.
the class TagRepositoryValidationDecoratorTest method testUpdateStreamInvalid.
@Test(expectedExceptions = MolgenisValidationException.class)
public void testUpdateStreamInvalid() throws Exception {
Tag tag0 = mock(Tag.class);
Tag tag1 = mock(Tag.class);
doNothing().when(tagValidator).validate(tag0);
doThrow(mock(MolgenisValidationException.class)).when(tagValidator).validate(tag1);
tagRepositoryValidationDecorator.update(Stream.of(tag0, tag1));
@SuppressWarnings("unchecked") ArgumentCaptor<Stream<Tag>> tagCaptor = ArgumentCaptor.forClass(Stream.class);
verify(delegateRepository).update(tagCaptor.capture());
// consume stream
tagCaptor.getValue().count();
}
use of org.molgenis.data.meta.model.Tag in project molgenis by molgenis.
the class TagRepositoryValidationDecoratorTest method testAddStreamValid.
@Test
public void testAddStreamValid() throws Exception {
Tag tag0 = mock(Tag.class);
Tag tag1 = mock(Tag.class);
doNothing().when(tagValidator).validate(tag0);
doNothing().when(tagValidator).validate(tag1);
tagRepositoryValidationDecorator.add(Stream.of(tag0, tag1));
@SuppressWarnings("unchecked") ArgumentCaptor<Stream<Tag>> tagCaptor = ArgumentCaptor.forClass(Stream.class);
verify(delegateRepository).add(tagCaptor.capture());
assertEquals(tagCaptor.getValue().collect(toList()), asList(tag0, tag1));
verify(tagValidator).validate(tag0);
verify(tagValidator).validate(tag1);
}
use of org.molgenis.data.meta.model.Tag in project molgenis by molgenis.
the class TagRepositoryValidationDecoratorTest method testAddValid.
@Test
public void testAddValid() throws Exception {
Tag tag = mock(Tag.class);
doNothing().when(tagValidator).validate(tag);
tagRepositoryValidationDecorator.add(tag);
verify(tagValidator).validate(tag);
verify(delegateRepository).add(tag);
}
use of org.molgenis.data.meta.model.Tag in project molgenis by molgenis.
the class TagRepositoryValidationDecoratorTest method testUpdateValid.
@Test
public void testUpdateValid() throws Exception {
Tag tag = mock(Tag.class);
doNothing().when(tagValidator).validate(tag);
tagRepositoryValidationDecorator.update(tag);
verify(tagValidator).validate(tag);
verify(delegateRepository).update(tag);
}
use of org.molgenis.data.meta.model.Tag in project molgenis by molgenis.
the class TagRepositoryValidationDecoratorTest method testAddInValid.
@Test(expectedExceptions = MolgenisValidationException.class)
public void testAddInValid() throws Exception {
Tag tag = mock(Tag.class);
doThrow(mock(MolgenisValidationException.class)).when(tagValidator).validate(tag);
tagRepositoryValidationDecorator.add(tag);
}
Aggregations