migrated to Java 8
This commit is contained in:
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import static org.apache.log4j.PropertyConfigurator.configure;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
@ -19,7 +20,7 @@ public class BaseTest {
|
||||
@BeforeClass
|
||||
public static void initLogging() {
|
||||
URL defaultConfigUrl = BaseTest.class.getResource("/logging.properties");
|
||||
PropertyConfigurator.configure(defaultConfigUrl);
|
||||
configure(defaultConfigUrl);
|
||||
}
|
||||
|
||||
public String readContentFromFile(String name) throws IOException {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -19,7 +20,7 @@ public class CidrToolTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testCidrConversion() {
|
||||
System.out.println (CidrTool.rangeToCidrList("213.55.64.0", "213.55.127.255"));
|
||||
System.out.println (rangeToCidrList("213.55.64.0", "213.55.127.255"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -27,12 +28,12 @@ public class CidrToolTest {
|
||||
// split 213.0.0.0/8 --> belongs to Ripe
|
||||
// but 213.55.64.0 - 213.55.127.255 was transferred to Afrinic
|
||||
System.out.println ("First part of Ripe");
|
||||
System.out.println (CidrTool.rangeToCidrList("213.0.0.1", "213.55.63.255"));
|
||||
System.out.println (rangeToCidrList("213.0.0.1", "213.55.63.255"));
|
||||
|
||||
System.out.println ("Transferred part of Afrinic");
|
||||
System.out.println (CidrTool.rangeToCidrList("213.55.64.0", "213.55.127.255"));
|
||||
System.out.println (rangeToCidrList("213.55.64.0", "213.55.127.255"));
|
||||
|
||||
System.out.println ("Second part of Ripe");
|
||||
System.out.println (CidrTool.rangeToCidrList("213.55.128.0", "213.255.255.255"));
|
||||
System.out.println (rangeToCidrList("213.55.128.0", "213.255.255.255"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -11,6 +12,6 @@ public class RangeToCidrTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRangeToCidr() {
|
||||
System.out.println (CidrTool.rangeToCidrList("212.204.60.0", "212.204.60.255"));
|
||||
System.out.println (rangeToCidrList("212.204.60.0", "212.204.60.255"));
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@ import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
@ -57,7 +58,7 @@ public class FTPConnectionTest {
|
||||
fin.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(FTPConnectionTest.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(FTPConnectionTest.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public class HttpLayerTest extends BaseTest {
|
||||
@Ignore
|
||||
public void testPostByMap() throws Exception {
|
||||
System.out.println("testPostByMap");
|
||||
Map<String, String[]> map = new HashMap<String, String[]>();
|
||||
Map<String, String[]> map = new HashMap<>();
|
||||
String[] value = {"Hello World!", "Hello World again"};
|
||||
map.put("message", value);
|
||||
|
||||
@ -35,12 +35,12 @@ public class HttpLayerTest extends BaseTest {
|
||||
@Ignore
|
||||
public void testPostByMapList() throws Exception {
|
||||
System.out.println("testPostByMapList");
|
||||
List<Map<String, String[]>> list = new LinkedList<Map<String, String[]>>();
|
||||
Map<String, String[]> map = new HashMap<String, String[]>();
|
||||
List<Map<String, String[]>> list = new LinkedList<>();
|
||||
Map<String, String[]> map = new HashMap<>();
|
||||
String[] value = {"Hello World!", "Hello World again"};
|
||||
map.put("message", value);
|
||||
list.add(map);
|
||||
map = new HashMap<String, String[]>();
|
||||
map = new HashMap<>();
|
||||
String[] urlValue = {"http://localhost:8080/testurl"};
|
||||
map.put("url", urlValue);
|
||||
list.add(map);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package de.muehlencord.shared.network.mail;
|
||||
|
||||
import de.muehlencord.shared.network.BaseTest;
|
||||
import static de.muehlencord.shared.network.mail.MailReaderConfigurationFactory.getConfiguration;
|
||||
import de.muehlencord.shared.network.mail.imap.ImapMailReader;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
@ -31,7 +32,7 @@ public class MailMessageUtilsTest extends BaseTest {
|
||||
}
|
||||
|
||||
String testConfigFile = file.toString();
|
||||
MailReaderConfiguration config = MailReaderConfigurationFactory.getConfiguration(testConfigFile);
|
||||
MailReaderConfiguration config = getConfiguration(testConfigFile);
|
||||
MailReader mr = new ImapMailReader(config);
|
||||
mr.connect();
|
||||
List<MailMessage> mm = mr.getMessages("INBOX");
|
||||
|
||||
Reference in New Issue
Block a user