Skip to content
Snippets Groups Projects
Commit beebeaa4 authored by uhensler's avatar uhensler
Browse files

OO-5273: Fix unit tests

parent 72d44a74
No related branches found
No related tags found
No related merge requests found
...@@ -81,12 +81,24 @@ public class OnlyOfficeServiceImplTest { ...@@ -81,12 +81,24 @@ public class OnlyOfficeServiceImplTest {
} }
@Test @Test
public void shouldNotAllowEditIfAllLicensesInUse() { public void shouldAllowEditIfAlmostAllLicensesInUse() {
// Because the access is created before the license check is done,
// the access is demanding for the last license.
when(onlyOfficeModuleMock.getLicenseEdit()).thenReturn(10); when(onlyOfficeModuleMock.getLicenseEdit()).thenReturn(10);
when(documentEditorServiceMock.getAccessCount(any(), any())).thenReturn(Long.valueOf(10)); when(documentEditorServiceMock.getAccessCount(any(), any())).thenReturn(Long.valueOf(10));
boolean editLicenseAvailable = sut.isEditLicenseAvailable(); boolean editLicenseAvailable = sut.isEditLicenseAvailable();
assertThat(editLicenseAvailable).isTrue();
}
@Test
public void shouldNotAllowEditIfAllLicensesInUse() {
when(onlyOfficeModuleMock.getLicenseEdit()).thenReturn(10);
when(documentEditorServiceMock.getAccessCount(any(), any())).thenReturn(Long.valueOf(11));
boolean editLicenseAvailable = sut.isEditLicenseAvailable();
assertThat(editLicenseAvailable).isFalse(); assertThat(editLicenseAvailable).isFalse();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment