@Test public void computeWarningMessageForAddLinkCheck_shouldReturnNull_GivenSenderIncomingAndReceiverNone() { Assert.assertEquals(null, this.service.computeWarningMessageForAddLinkCheck(CommunicationService.Direction.INCOMING, CommunicationService.Direction.NONE)); }
public String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection) { if (startDirection.equals(Direction.OUTGOING) && endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_BOTH_GROUPS_USERS_CAN_COMMUNICATE; } if (startDirection.equals(Direction.OUTGOING)) { return CommunicationService.WARNING_STARTGROUP_USERS_CAN_COMMUNICATE; } if (endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_ENDGROUP_USERS_CAN_COMMUNICATE; } return null; }
DefaultCommunicationService implements CommunicationService { public String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection) { if (startDirection.equals(Direction.OUTGOING) && endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_BOTH_GROUPS_USERS_CAN_COMMUNICATE; } if (startDirection.equals(Direction.OUTGOING)) { return CommunicationService.WARNING_STARTGROUP_USERS_CAN_COMMUNICATE; } if (endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_ENDGROUP_USERS_CAN_COMMUNICATE; } return null; } }
DefaultCommunicationService implements CommunicationService { public String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection) { if (startDirection.equals(Direction.OUTGOING) && endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_BOTH_GROUPS_USERS_CAN_COMMUNICATE; } if (startDirection.equals(Direction.OUTGOING)) { return CommunicationService.WARNING_STARTGROUP_USERS_CAN_COMMUNICATE; } if (endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_ENDGROUP_USERS_CAN_COMMUNICATE; } return null; }  }
DefaultCommunicationService implements CommunicationService { public String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection) { if (startDirection.equals(Direction.OUTGOING) && endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_BOTH_GROUPS_USERS_CAN_COMMUNICATE; } if (startDirection.equals(Direction.OUTGOING)) { return CommunicationService.WARNING_STARTGROUP_USERS_CAN_COMMUNICATE; } if (endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_ENDGROUP_USERS_CAN_COMMUNICATE; } return null; }  @Override void addLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void removeLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkWithUsers(String groupId, Direction direction, Handler<Either<String, JsonObject>> handler); @Override void addLinkWithUsers(Map<String, Direction> params, Handler<Either<String, JsonObject>> handler); @Override void removeLinkWithUsers(String groupId, Direction direction, Handler<Either<String, JsonObject>> handler); @Override void communiqueWith(String groupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkBetweenRelativeAndStudent(String groupId, Direction direction,
			Handler<Either<String, JsonObject>> handler); @Override void removeLinkBetweenRelativeAndStudent(String groupId, Direction direction,
			Handler<Either<String, JsonObject>> handler); @Override void initDefaultRules(JsonArray structureIds, JsonObject defaultRules,
			final Handler<Either<String, JsonObject>> handler); @Override void applyDefaultRules(JsonArray structureIds, Handler<Either<String, JsonObject>> handler); @Override void applyRules(String groupId, Handler<Either<String, JsonObject>> handler); @Override void removeRules(String structureId, Handler<Either<String, JsonObject>> handler); @Override void visibleUsers(String userId, String structureId, JsonArray expectedTypes, boolean itSelf,
							 boolean myGroup, boolean profile, String preFilter, String customReturn, JsonObject additionnalParams,
							 final Handler<Either<String, JsonArray>> handler); @Override void visibleUsers(String userId, String structureId, JsonArray expectedTypes, boolean itSelf,
			boolean myGroup, boolean profile, String preFilter, String customReturn, JsonObject additionnalParams, String userProfile,
			final Handler<Either<String, JsonArray>> handler); @Override void usersCanSeeMe(String userId, Handler<Either<String, JsonArray>> handler); @Override void visibleProfilsGroups(String userId, String customReturn, JsonObject additionnalParams,
			String preFilter, Handler<Either<String, JsonArray>> handler); @Override void visibleManualGroups(String userId, String customReturn, JsonObject additionnalParams,
			Handler<Either<String, JsonArray>> handler); @Override void getOutgoingRelations(String id, Handler<Either<String, JsonArray>> results); @Override void getIncomingRelations(String id, Handler<Either<String, JsonArray>> results); @Override void safelyRemoveLinkWithUsers(String groupId, Handler<Either<String, JsonObject>> handler); @Override void getDirections(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkCheckOnly(String startGroupId, String endGroupId, UserInfos userInfos, Handler<Either<String, JsonObject>> handler); @Override void removeRelations(String sendingGroupId, String receivingGroupId, Handler<Either<String, JsonObject>> handler); @Override void processChangeDirectionAfterAddingLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); Direction computeDirectionToRemove(boolean hasIncomingRelationship, boolean hasOutgoingRelationship); Direction computeNextDirection(Direction directionToRemove); String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection); boolean isImpossibleToChangeDirectionGroupForAddLink(String filter, String subType, UserInfos userInfos); Map<String, Direction> computeNewDirectionAfterAddingLink(String startGroupId, Direction startDirection, String endGroupId, Direction endDirection); }
DefaultCommunicationService implements CommunicationService { public String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection) { if (startDirection.equals(Direction.OUTGOING) && endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_BOTH_GROUPS_USERS_CAN_COMMUNICATE; } if (startDirection.equals(Direction.OUTGOING)) { return CommunicationService.WARNING_STARTGROUP_USERS_CAN_COMMUNICATE; } if (endDirection.equals(Direction.INCOMING)) { return CommunicationService.WARNING_ENDGROUP_USERS_CAN_COMMUNICATE; } return null; }  @Override void addLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void removeLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkWithUsers(String groupId, Direction direction, Handler<Either<String, JsonObject>> handler); @Override void addLinkWithUsers(Map<String, Direction> params, Handler<Either<String, JsonObject>> handler); @Override void removeLinkWithUsers(String groupId, Direction direction, Handler<Either<String, JsonObject>> handler); @Override void communiqueWith(String groupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkBetweenRelativeAndStudent(String groupId, Direction direction,
			Handler<Either<String, JsonObject>> handler); @Override void removeLinkBetweenRelativeAndStudent(String groupId, Direction direction,
			Handler<Either<String, JsonObject>> handler); @Override void initDefaultRules(JsonArray structureIds, JsonObject defaultRules,
			final Handler<Either<String, JsonObject>> handler); @Override void applyDefaultRules(JsonArray structureIds, Handler<Either<String, JsonObject>> handler); @Override void applyRules(String groupId, Handler<Either<String, JsonObject>> handler); @Override void removeRules(String structureId, Handler<Either<String, JsonObject>> handler); @Override void visibleUsers(String userId, String structureId, JsonArray expectedTypes, boolean itSelf,
							 boolean myGroup, boolean profile, String preFilter, String customReturn, JsonObject additionnalParams,
							 final Handler<Either<String, JsonArray>> handler); @Override void visibleUsers(String userId, String structureId, JsonArray expectedTypes, boolean itSelf,
			boolean myGroup, boolean profile, String preFilter, String customReturn, JsonObject additionnalParams, String userProfile,
			final Handler<Either<String, JsonArray>> handler); @Override void usersCanSeeMe(String userId, Handler<Either<String, JsonArray>> handler); @Override void visibleProfilsGroups(String userId, String customReturn, JsonObject additionnalParams,
			String preFilter, Handler<Either<String, JsonArray>> handler); @Override void visibleManualGroups(String userId, String customReturn, JsonObject additionnalParams,
			Handler<Either<String, JsonArray>> handler); @Override void getOutgoingRelations(String id, Handler<Either<String, JsonArray>> results); @Override void getIncomingRelations(String id, Handler<Either<String, JsonArray>> results); @Override void safelyRemoveLinkWithUsers(String groupId, Handler<Either<String, JsonObject>> handler); @Override void getDirections(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); @Override void addLinkCheckOnly(String startGroupId, String endGroupId, UserInfos userInfos, Handler<Either<String, JsonObject>> handler); @Override void removeRelations(String sendingGroupId, String receivingGroupId, Handler<Either<String, JsonObject>> handler); @Override void processChangeDirectionAfterAddingLink(String startGroupId, String endGroupId, Handler<Either<String, JsonObject>> handler); Direction computeDirectionToRemove(boolean hasIncomingRelationship, boolean hasOutgoingRelationship); Direction computeNextDirection(Direction directionToRemove); String computeWarningMessageForAddLinkCheck(Direction startDirection, Direction endDirection); boolean isImpossibleToChangeDirectionGroupForAddLink(String filter, String subType, UserInfos userInfos); Map<String, Direction> computeNewDirectionAfterAddingLink(String startGroupId, Direction startDirection, String endGroupId, Direction endDirection);  }