From: David ‘Bombe’ Roden Date: Sat, 6 Nov 2021 20:52:16 +0000 (+0100) Subject: 🔀 Merge remote-tracking branch 'origin/master' X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0df7b8013abac27e1071761b98a106744fe1f929;hp=845acd1b9805e5cb84ba03f6a493014a38b9e798;p=xudocci.git 🔀 Merge remote-tracking branch 'origin/master' --- diff --git a/src/main/java/net/pterodactylus/irc/DefaultConnection.java b/src/main/java/net/pterodactylus/irc/DefaultConnection.java index 79ab87b..e44a48c 100644 --- a/src/main/java/net/pterodactylus/irc/DefaultConnection.java +++ b/src/main/java/net/pterodactylus/irc/DefaultConnection.java @@ -98,13 +98,7 @@ public class DefaultConnection extends AbstractExecutionThreadService implements private final int port; /** The nickname chooser. */ - private NicknameChooser nicknameChooser = new NicknameChooser() { - - @Override - public String getNickname() { - return RandomNickname.get(); - } - }; + private final NicknameChooser nicknameChooser = RandomNickname::get; /** The nickname. */ private String nickname = null; diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index db64416..8ef074c 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -23,7 +23,6 @@ import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.banned; import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.inviteOnly; import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.registeredNicknamesOnly; import static net.pterodactylus.irc.util.MessageCleaner.getDefaultInstance; -import static net.pterodactylus.xdcc.data.Channel.TO_NETWORK; import static net.pterodactylus.xdcc.data.Download.FILTER_RUNNING; import java.io.File; @@ -187,7 +186,7 @@ public class Core extends AbstractExecutionThreadService { * @return All defined networks */ public Collection networks() { - return FluentIterable.from(channels).transform(TO_NETWORK).toSet(); + return FluentIterable.from(channels).transform(Channel::network).toSet(); } /** diff --git a/src/main/java/net/pterodactylus/xdcc/data/Channel.java b/src/main/java/net/pterodactylus/xdcc/data/Channel.java index f4c8d01..68e0cb6 100644 --- a/src/main/java/net/pterodactylus/xdcc/data/Channel.java +++ b/src/main/java/net/pterodactylus/xdcc/data/Channel.java @@ -28,14 +28,6 @@ import com.google.common.base.Function; */ public class Channel { - /** Function to convert a channel to its network. */ - public static final Function TO_NETWORK = new Function() { - @Override - public Network apply(Channel channel) { - return channel.network(); - } - }; - /** The network this channel belongs to. */ private final Network network; diff --git a/src/test/java/net/pterodactylus/xdcc/data/BotTest.java b/src/test/java/net/pterodactylus/xdcc/data/BotTest.java index 57e3de3..75685a7 100644 --- a/src/test/java/net/pterodactylus/xdcc/data/BotTest.java +++ b/src/test/java/net/pterodactylus/xdcc/data/BotTest.java @@ -1,5 +1,8 @@ package net.pterodactylus.xdcc.data; +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; + import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; @@ -21,7 +24,7 @@ public class BotTest { public void addingOneFileWithTwoIdsRemovesTheOldId() { bot.addPack(oldPack); bot.addPack(newPack); - MatcherAssert.assertThat(bot.packs(), Matchers.contains(newPack)); + assertThat(bot.packs(), contains(newPack)); } }