forked from AuthorizeNet/sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentTest.java
More file actions
45 lines (38 loc) · 1.37 KB
/
EnvironmentTest.java
File metadata and controls
45 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package net.authorize;
/*
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Properties;
*/
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
public class EnvironmentTest extends UnitTestData {
@Before
public void setUp() throws Exception {
}
@Test
public void createCustomEnvironment() {
Environment environment = Environment.createEnvironment(
"http://localhost:8080", "http://localhost:8081");
Assert.assertEquals("http://localhost:8080", environment.getBaseUrl());
Assert.assertEquals("http://localhost:8081", environment.getXmlBaseUrl());
Assert.assertEquals(Environment.CUSTOM.name(), environment.name());
}
@Test
public void testInternetConnectionViaProxy() {
boolean internetAccessible = UnitTestData.isInternetAccessible();
if ( !internetAccessible) {
System.out.println("Make sure to set the following properties in the environment or via properties file.");
for (String property : UnitTestData.getPropertiesList()) {
if ( !property.toLowerCase().contains("password")) {
System.out.printf("Property '%s'%s", property, net.authorize.util.LogHelper.LineSeparator);
}
}
}
Assert.assertTrue("Internet is not accessible.", internetAccessible);
}
}