@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)); }
@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); } }
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); } } }
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); }
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);  }
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);   }