Skip to content

Commit

Permalink
Merge pull request #131 from basil/guava
Browse files Browse the repository at this point in the history
Remove usages of Guava
  • Loading branch information
alecharp committed Oct 4, 2021
2 parents 11f543f + 13fec1e commit 64d8c6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package jenkins.plugins.mailer.tasks;

import com.google.common.collect.Lists;
import hudson.model.TaskListener;
import hudson.remoting.Base64;
import hudson.tasks.Mailer;
Expand Down Expand Up @@ -53,6 +52,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
Expand Down Expand Up @@ -284,7 +284,7 @@ private void addRecipients(MimeMessage msg, Set<InternetAddress> recipientList,
}

private List<InternetAddress> toNormalizedAddresses(String addresses) throws UnsupportedEncodingException {
final List<InternetAddress> list = Lists.newLinkedList();
final List<InternetAddress> list = new LinkedList<>();
if (StringUtils.isNotBlank(addresses)) {
StringTokenizer tokens = new StringTokenizer(addresses, " \t\n\r\f,");
while (tokens.hasMoreTokens()) {
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/hudson/tasks/MailSenderTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package hudson.tasks;

import com.google.common.collect.Sets;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
Expand All @@ -14,6 +13,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import jenkins.model.Jenkins;
import jenkins.plugins.mailer.tasks.i18n.Messages;
Expand Down Expand Up @@ -75,17 +75,17 @@ public void testIncludeUpstreamCulprits() throws Exception {

User user1 = mock(User.class);
when(user1.getProperty(Mailer.UserProperty.class)).thenReturn(new Mailer.UserProperty("this.one.should.not.be.included@example.com"));
Set<User> badGuys1 = Sets.newHashSet(user1);
Set<User> badGuys1 = Collections.singleton(user1);
when(previousBuildUpstreamBuild.getCulprits()).thenReturn(badGuys1);

User user2 = mock(User.class);
when(user2.getProperty(Mailer.UserProperty.class)).thenReturn(new Mailer.UserProperty("this.one.must.be.included@example.com"));
Set<User> badGuys2 = Sets.newHashSet(user2);
Set<User> badGuys2 = Collections.singleton(user2);
when(upstreamBuildBetweenPreviousAndCurrent.getCulprits()).thenReturn(badGuys2);

User user3 = mock(User.class);
when(user3.getProperty(Mailer.UserProperty.class)).thenReturn(new Mailer.UserProperty("this.one.must.be.included.too@example.com"));
Set<User> badGuys3 = Sets.newHashSet(user3);
Set<User> badGuys3 = Collections.singleton(user3);
when(upstreamBuild.getCulprits()).thenReturn(badGuys3);


Expand Down Expand Up @@ -155,7 +155,7 @@ private static void createPreviousNextRelationShip(AbstractBuild... builds) {
when(externalU.getProperty(Mailer.UserProperty.class)).thenReturn(new Mailer.UserProperty("someone@nowhere.net"));
when(externalU.impersonate()).thenThrow(new UsernameNotFoundException(""));
AbstractBuild<?, ?> build = mock(AbstractBuild.class);
when(build.getCulprits()).thenReturn(Sets.newLinkedHashSet(Arrays.asList(authorizedU, unauthorizedU, externalU)));
when(build.getCulprits()).thenReturn(new LinkedHashSet<>(Arrays.asList(authorizedU, unauthorizedU, externalU)));
when(build.getACL()).thenReturn(acl);
when(build.getFullDisplayName()).thenReturn("prj #1");
StringWriter sw = new StringWriter();
Expand Down

0 comments on commit 64d8c6b

Please sign in to comment.