X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FWebOfTrustUpdaterTest.java;h=7529fc6d03a35a77db166f611a9602d3ee0a5215;hp=2caecf81664d602d22a14c45cd952759e8a3998d;hb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;hpb=f6abaa22308385d6b7418e29654135fc9cb34798 diff --git a/src/test/java/net/pterodactylus/sone/core/WebOfTrustUpdaterTest.java b/src/test/java/net/pterodactylus/sone/core/WebOfTrustUpdaterTest.java index 2caecf8..7529fc6 100644 --- a/src/test/java/net/pterodactylus/sone/core/WebOfTrustUpdaterTest.java +++ b/src/test/java/net/pterodactylus/sone/core/WebOfTrustUpdaterTest.java @@ -6,7 +6,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; @@ -15,7 +15,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.AddContextJob; import net.pterodactylus.sone.core.WebOfTrustUpdaterImpl.RemoveContextJob; @@ -364,30 +363,6 @@ public class WebOfTrustUpdaterTest { } @Test - public void multipleCallsToAddContextAreCollapsed() throws InterruptedException, PluginException { - final AtomicInteger errorCount = new AtomicInteger(); - final CountDownLatch addContextsFinished = new CountDownLatch(2); - for (int i = 1; i <= 2; i++) { - /* this is so fucking volatile. */ - if (i > 1) { - sleep(200); - } - new Thread(new Runnable() { - public void run() { - if (!webOfTrustUpdater.addContextWait(ownIdentity, CONTEXT)) { - errorCount.incrementAndGet(); - } - addContextsFinished.countDown(); - } - }).start(); - } - webOfTrustUpdater.start(); - assertThat(addContextsFinished.await(1, SECONDS), is(true)); - verify(ownIdentity).addContext(eq(CONTEXT)); - assertThat(errorCount.get(), is(0)); - } - - @Test public void removeContextRemovesAContext() throws InterruptedException, PluginException { webOfTrustUpdater.start(); final CountDownLatch removeContextTrigger = new CountDownLatch(1); @@ -433,7 +408,7 @@ public class WebOfTrustUpdaterTest { @Test public void setTrustSetsTrust() throws InterruptedException, PluginException { - final CountDownLatch trustSetTrigger =new CountDownLatch(1); + final CountDownLatch trustSetTrigger = new CountDownLatch(1); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocation) throws Throwable {