diff --git a/src/test/java/org/olat/core/commons/services/doceditor/onlyoffice/manager/OnlyOfficeServiceImplTest.java b/src/test/java/org/olat/core/commons/services/doceditor/onlyoffice/manager/OnlyOfficeServiceImplTest.java index 6784dbb2b78b08266fe24f27f0ded8f619778f8c..85cf1c04be820010bf038672195dd31922330a45 100644 --- a/src/test/java/org/olat/core/commons/services/doceditor/onlyoffice/manager/OnlyOfficeServiceImplTest.java +++ b/src/test/java/org/olat/core/commons/services/doceditor/onlyoffice/manager/OnlyOfficeServiceImplTest.java @@ -81,12 +81,24 @@ public class OnlyOfficeServiceImplTest { } @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(documentEditorServiceMock.getAccessCount(any(), any())).thenReturn(Long.valueOf(10)); 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(); }