2018-02-17 22:04:06 +01:00
|
|
|
import net.knarcraft.serverlauncher.profile.Profile;
|
|
|
|
import net.knarcraft.serverlauncher.server.ServerType;
|
2018-09-30 17:06:57 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
2018-02-17 22:04:06 +01:00
|
|
|
|
|
|
|
import javax.naming.ConfigurationException;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
|
|
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
2018-09-30 17:06:57 +02:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
2018-02-17 22:04:06 +01:00
|
|
|
|
|
|
|
public class Tests {
|
|
|
|
@Test
|
|
|
|
public void loadServerVersions() throws ConfigurationException { //Make sure the server versions file has correct syntax
|
|
|
|
ServerType.loadServerTypes();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void saveProfile() throws FileNotFoundException { //Make sure we can write profiles to disk
|
|
|
|
Profile.addProfile("Test");
|
|
|
|
Profile.getCurrent().save();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void stringBetweenTest() { //Make sure stringBetween is not creating exceptions
|
|
|
|
String substring = stringBetween("fish'nchips", "f", "'");
|
|
|
|
assertEquals("ish", substring);
|
|
|
|
substring = stringBetween("something", "whale", "fish");
|
|
|
|
assertEquals("", substring);
|
|
|
|
substring = stringBetween("something", "so", "fish");
|
|
|
|
assertEquals("", substring);
|
|
|
|
substring = stringBetween("something", "asd", "ing");
|
|
|
|
assertEquals("", substring);
|
|
|
|
}
|
|
|
|
}
|