mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 00:51:25 +01:00
Fix HastebinTest (Thread wasn't started...)
This commit is contained in:
parent
5cc5d61816
commit
15587946e6
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.djrapitops:PlanPluginBridge:3.6.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/PlanPluginBridge/3.6.0/PlanPluginBridge-3.6.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -11,6 +11,6 @@ public class Sql {
|
||||
}
|
||||
|
||||
public static String varchar(int length) {
|
||||
return "varchar("+length+")";
|
||||
return "varchar(" + length + ")";
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import test.java.utils.RandomData;
|
||||
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;
|
||||
@ -28,7 +28,7 @@ import static junit.framework.TestCase.assertNotNull;
|
||||
@PrepareForTest(JavaPlugin.class)
|
||||
public class HastebinTest {
|
||||
|
||||
private AtomicBoolean hastebinAvailable = new AtomicBoolean();
|
||||
private AtomicReference<String> testLink = new AtomicReference<>(null);
|
||||
|
||||
@Before
|
||||
public void checkAvailability() throws Exception {
|
||||
@ -40,27 +40,25 @@ public class HastebinTest {
|
||||
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
|
||||
@ -75,7 +73,8 @@ public class HastebinTest {
|
||||
|
||||
@Test
|
||||
public void testUpload() throws Exception {
|
||||
if (!hastebinAvailable.get()) {
|
||||
if (testLink.get() == null) {
|
||||
Log.info("Hastebin not available, skipping testUpload()");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user