@Test public void testFindDefaultVersion() { recreateVersions(); Version version = versionRepository.findDefault(docId); assertNotNull(version); assertThat(version.getDocId(), is(docId)); assertThat(version.getNo(), is(3)); }
@Test public void testCreate() { recreateVersions(); Version version = versionRepository.create(docId, userId); assertNotNull(version); assertThat(version.getDocId(), is(docId)); assertThat(version.getNo(), is(6)); assertThat(version.getCreatedBy(), equalTo(userRepository.findOne(userId))); }
@Test public void testSetDefault() { recreateVersions(); assertThat(versionRepository.findDefault(docId).getNo(), is(3)); versionRepository.updateDefaultNo(docId, 4, userId); Version version = versionRepository.findDefault(docId); assertNotNull(version); assertThat(version.getDocId(), is(docId)); assertThat(version.getNo(), is(4)); assertThat(version.getModifiedBy(), equalTo(userRepository.findOne(userId))); }