@Test public void applyUpdate() throws Exception { ChatUpdate update = new ChatUpdate(date, creator1, group1, message1); update.applyUpdate(mockRepos); verify(mockUserRepository).getUser(creator1); verify(mockUser).getUserId(); verify(mockChatRepository).addMessage(mockMessage); }
@Override public void applyUpdate(RepositorySet repositorySet) { User sender = repositorySet.userRepository.getUser(creator); if (sender == null) sender = User.getPlaceholderAndScheduleQuery(creator, repositorySet.userRepository); ChatMessage chatMessage = new ChatMessage(groupId, message, sender.getUserId(), sender.getUsername(), timeCreated); repositorySet.chatRepository.addMessage(chatMessage); }
ChatUpdate extends Update { @Override public void applyUpdate(RepositorySet repositorySet) { User sender = repositorySet.userRepository.getUser(creator); if (sender == null) sender = User.getPlaceholderAndScheduleQuery(creator, repositorySet.userRepository); ChatMessage chatMessage = new ChatMessage(groupId, message, sender.getUserId(), sender.getUsername(), timeCreated); repositorySet.chatRepository.addMessage(chatMessage); } }
ChatUpdate extends Update { @Override public void applyUpdate(RepositorySet repositorySet) { User sender = repositorySet.userRepository.getUser(creator); if (sender == null) sender = User.getPlaceholderAndScheduleQuery(creator, repositorySet.userRepository); ChatMessage chatMessage = new ChatMessage(groupId, message, sender.getUserId(), sender.getUsername(), timeCreated); repositorySet.chatRepository.addMessage(chatMessage); } ChatUpdate(@JsonProperty("time-created") Date timeCreated,
                      @JsonProperty("creator") int creator,
                      @JsonProperty("group-id") int groupId,
                      @JsonProperty("message") String message); }
ChatUpdate extends Update { @Override public void applyUpdate(RepositorySet repositorySet) { User sender = repositorySet.userRepository.getUser(creator); if (sender == null) sender = User.getPlaceholderAndScheduleQuery(creator, repositorySet.userRepository); ChatMessage chatMessage = new ChatMessage(groupId, message, sender.getUserId(), sender.getUsername(), timeCreated); repositorySet.chatRepository.addMessage(chatMessage); } ChatUpdate(@JsonProperty("time-created") Date timeCreated,
                      @JsonProperty("creator") int creator,
                      @JsonProperty("group-id") int groupId,
                      @JsonProperty("message") String message); @Override void applyUpdate(RepositorySet repositorySet); }
ChatUpdate extends Update { @Override public void applyUpdate(RepositorySet repositorySet) { User sender = repositorySet.userRepository.getUser(creator); if (sender == null) sender = User.getPlaceholderAndScheduleQuery(creator, repositorySet.userRepository); ChatMessage chatMessage = new ChatMessage(groupId, message, sender.getUserId(), sender.getUsername(), timeCreated); repositorySet.chatRepository.addMessage(chatMessage); } ChatUpdate(@JsonProperty("time-created") Date timeCreated,
                      @JsonProperty("creator") int creator,
                      @JsonProperty("group-id") int groupId,
                      @JsonProperty("message") String message); @Override void applyUpdate(RepositorySet repositorySet);  }