added esapi config
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
*/
|
||||
public class OSUtilTest {
|
||||
|
||||
/**
|
||||
* executes getOS method
|
||||
*/
|
||||
@Test
|
||||
public void testGetOS() {
|
||||
String osName = System.getProperties().getProperty("os.name").toUpperCase();
|
||||
int os = OSUtil.getOperationSystem();
|
||||
|
||||
switch (osName) {
|
||||
case "LINUX":
|
||||
assertTrue(os == OSUtil.OS_LINUX);
|
||||
break;
|
||||
case "WINDOWS":
|
||||
assertTrue(os == OSUtil.OS_WINDOWS);
|
||||
break;
|
||||
default:
|
||||
fail("Unknown / unsupported OS for test case");
|
||||
}
|
||||
|
||||
System.out.println(osName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package de.muehlencord.shared.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
*/
|
||||
public class StringEncodingExceptionTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testDefaultConstructor() {
|
||||
StringEncodingException ex = new StringEncodingException();
|
||||
assertTrue (ex.getMessage().equals (StringEncodingException.DEFAULT_MSG));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageConstructor() {
|
||||
String msg = "Test message";
|
||||
StringEncodingException ex = new StringEncodingException(msg);
|
||||
assertTrue (ex.getMessage().equals (msg));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRootcauseConstructor() {
|
||||
String msg = "Test message";
|
||||
StringEncodingException rootCause = new StringEncodingException();
|
||||
StringEncodingException ex = new StringEncodingException(msg, rootCause);
|
||||
assertTrue (ex.getMessage().equals (msg));
|
||||
assertTrue (ex.getCause().equals (rootCause));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
package de.muehlencord.shared.util;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -8,16 +7,16 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Basic StringUtilTests
|
||||
*
|
||||
* @author joern@muehlencord.de
|
||||
*/
|
||||
public class StringUtilTest extends DefaultTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetValueBetweenKeywords() throws ParseException, IOException {
|
||||
String content = readContentFromFile("test.txt");
|
||||
|
||||
String ipAddress = StringUtil.getValueBetweenKeywords(content, "The IP", "has just");
|
||||
assertEquals ("ipAddress", "222.184.230.118", ipAddress);
|
||||
String content = readContentFromFile("test.txt");
|
||||
|
||||
String ipAddress = StringUtil.getValueBetweenKeywords(content, "The IP", "has just");
|
||||
assertEquals("ipAddress", "222.184.230.118", ipAddress);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user