### Question:
KieMultipleDocumentEditorLockSyncHelper extends HasLockSyncMenuStateHelper.BasicLockSyncMenuStateHelper { @Override public Operation enable(final Path file, final boolean isLocked, final boolean isLockedByCurrentUser) { final KieDocument activeDocument = editor.getActiveDocument(); if (activeDocument == null || !activeDocument.getCurrentPath().equals(file)) { return Operation.VETO; } return super.enable(file, isLocked, isLockedByCurrentUser); } KieMultipleDocumentEditorLockSyncHelper(final KieMultipleDocumentEditor editor); @Override Operation enable(final Path file,
                            final boolean isLocked,
                            final boolean isLockedByCurrentUser);  }### Answer:
@Test public void testLocked_NullActiveDocument() { when( editor.getActiveDocument() ).thenReturn( null ); when( document.getCurrentPath() ).thenReturn( path ); final Operation op = lockSyncHelper.enable( mock( Path.class ), true, false ); assertEquals( Operation.VETO, op ); }
@Test public void testLocked_NotActiveDocument() { when( editor.getActiveDocument() ).thenReturn( document ); when( document.getCurrentPath() ).thenReturn( path ); final Operation op = lockSyncHelper.enable( mock( ObservablePath.class ), true, false ); assertEquals( Operation.VETO, op ); }
@Test public void testLocked_ActiveDocument() { when( editor.getActiveDocument() ).thenReturn( document ); when( document.getCurrentPath() ).thenReturn( path ); final Operation op = lockSyncHelper.enable( path, true, false ); assertEquals( Operation.DISABLE, op ); }
@Test public void testLockedByCurrentUser_ActiveDocument() { when( editor.getActiveDocument() ).thenReturn( document ); when( document.getCurrentPath() ).thenReturn( path ); final Operation op = lockSyncHelper.enable( path, true, true ); assertEquals( Operation.ENABLE, op ); }