Search in sources :

Example 1 with Tag

use of org.icij.datashare.text.Tag in project datashare by ICIJ.

the class JooqRepositoryTest method test_get_group_tag_of_document.

@Test
public void test_get_group_tag_of_document() {
    Date creationDate = new Date();
    repository.tag(project("prj"), asList("doc1", "doc2"), new Tag("tag", new User("foo"), creationDate));
    assertThat(repository.getTags(project("prj"), "doc1")).contains(tag("tag"));
    assertThat(repository.getTags(project("prj"), "doc2")).contains(tag("tag"));
}
Also used : User(org.icij.datashare.user.User) User.nullUser(org.icij.datashare.user.User.nullUser) Tag(org.icij.datashare.text.Tag) Test(org.junit.Test)

Example 2 with Tag

use of org.icij.datashare.text.Tag in project datashare by ICIJ.

the class JooqRepositoryTest method test_get_tags_of_document.

@Test
public void test_get_tags_of_document() {
    Date creationDate = new Date();
    assertThat(repository.tag(project("prj"), "doc_id", tag("tag1"), new Tag("tag2", new User("foo"), creationDate))).isTrue();
    assertThat(repository.getTags(project("prj"), "doc_id")).contains(tag("tag1"), tag("tag2"));
    assertThat(repository.getTags(project("unknown"), "doc_id")).isEmpty();
    assertThat(repository.getTags(project("prj"), "doc_id").get(0).user).isEqualTo(nullUser());
    assertThat(repository.getTags(project("prj"), "doc_id").get(0).creationDate).isNotNull();
    assertThat(repository.getTags(project("prj"), "doc_id").get(1).user).isEqualTo(new User("foo"));
    assertThat(repository.getTags(project("prj"), "doc_id").get(1).creationDate).isEqualTo(creationDate);
}
Also used : User(org.icij.datashare.user.User) User.nullUser(org.icij.datashare.user.User.nullUser) Tag(org.icij.datashare.text.Tag) Test(org.junit.Test)

Aggregations

Tag (org.icij.datashare.text.Tag)2 User (org.icij.datashare.user.User)2 User.nullUser (org.icij.datashare.user.User.nullUser)2 Test (org.junit.Test)2