### Question:
UserSyncAcceptor extends OperationAcceptor { @Override protected boolean doOperationsConflict(Operation operation, Operation other) { if (operation.getUserList().size() == 1) { return false; } else if (!operation.getUserList().isEmpty()) { return super.doOperationsConflict(operation, other); } else { return other.getUserList().isEmpty() && doEnvironmentsConflict(operation, other); } } @Inject  UserSyncAcceptor(OperationRepository operationRepository);   }### Answer:
@Test void testSingleUserAlwaysAcccepted() { Operation syncOperation = mock(Operation.class); when(syncOperation.getUserList()).thenReturn(List.of("userA")); Operation runningSyncOperation = mock(Operation.class); assertFalse(userSyncAcceptor.doOperationsConflict(syncOperation, runningSyncOperation)); }
@Test void testUserSyncAcceptedWithDifferentEnvironment() { Operation syncOperation = mock(Operation.class); when(syncOperation.getUserList()).thenReturn(List.of("userA", "userB")); when(syncOperation.getEnvironmentList()).thenReturn(List.of("envA")); Operation runningSyncOperation = mock(Operation.class); when(runningSyncOperation.getUserList()).thenReturn(List.of("userA")); when(runningSyncOperation.getEnvironmentList()).thenReturn(List.of("envB")); assertFalse(userSyncAcceptor.doOperationsConflict(syncOperation, runningSyncOperation)); }
@Test void testSingleUserSyncRejectedOnUserAndEnvOverlap() { Operation syncOperation = mock(Operation.class); when(syncOperation.getUserList()).thenReturn(List.of("userA", "userB")); when(syncOperation.getEnvironmentList()).thenReturn(List.of("envA")); Operation runningSyncOperation = mock(Operation.class); when(runningSyncOperation.getUserList()).thenReturn(List.of("userA")); when(runningSyncOperation.getEnvironmentList()).thenReturn(List.of("envA")); assertTrue(userSyncAcceptor.doOperationsConflict(syncOperation, runningSyncOperation)); }