Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of Guava #131

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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