Skip to content

Commit

Permalink
Fix HastebinTest (Thread wasn't started...)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzlemann committed Aug 17, 2017
1 parent 5cc5d61 commit 1558794
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
13 changes: 0 additions & 13 deletions .idea/libraries/Maven__com_djrapitops_PlanPluginBridge_3_6_0.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ private Sql() {
}

public static String varchar(int length) {
return "varchar("+length+")";
return "varchar(" + length + ")";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import test.java.utils.TestInit;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
Expand All @@ -28,7 +28,7 @@
@PrepareForTest(JavaPlugin.class)
public class HastebinTest {

private AtomicBoolean hastebinAvailable = new AtomicBoolean();
private AtomicReference<String> testLink = new AtomicReference<>(null);

@Before
public void checkAvailability() throws Exception {
Expand All @@ -40,27 +40,25 @@ public void checkAvailability() throws Exception {
link = Hastebin.upload(RandomData.randomString(10));
} catch (IOException e) {
if (e.getMessage().contains("503")) {
hastebinAvailable.set(false);
return;
}
} catch (ParseException e) {
/* Ignored */
}

if (link == null) {
hastebinAvailable.set(false);
}

Log.info("Availability Test Link: " + link);
Log.info(link);
testLink.set(link);
});

thread.start();

try {
thread.join(5000);
thread.join();
} catch (InterruptedException e) {
hastebinAvailable.set(false);
Log.info("InterruptedException: " + e.getMessage());
}

Log.info("Hastebin Available: " + hastebinAvailable.get());
Log.info("Hastebin Availability Test Link: " + testLink.get());
}

@Test
Expand All @@ -75,7 +73,8 @@ public void testSplitting() {

@Test
public void testUpload() throws Exception {
if (!hastebinAvailable.get()) {
if (testLink.get() == null) {
Log.info("Hastebin not available, skipping testUpload()");
return;
}

Expand Down

0 comments on commit 1558794

Please sign in to comment.