aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/helper/IpRetrieverTest.java
diff options
context:
space:
mode:
authordeveloperKurt <mustafakurt.business@gmail.com>2020-01-03 10:20:07 +0300
committerdeveloperKurt <mustafakurt.business@gmail.com>2020-01-03 10:20:07 +0300
commit13b27f8d7ac08bb3ff1a56a48865201263d6462d (patch)
tree0a64acc277808d83d6a7ce6a65da7ac42a2de05e /src/test/java/org/traccar/helper/IpRetrieverTest.java
parenta6ab28c8990d0506e20bb2c45ed9c6183a9b9594 (diff)
downloadtrackermap-server-13b27f8d7ac08bb3ff1a56a48865201263d6462d.tar.gz
trackermap-server-13b27f8d7ac08bb3ff1a56a48865201263d6462d.tar.bz2
trackermap-server-13b27f8d7ac08bb3ff1a56a48865201263d6462d.zip
As the owner requested:
• Javadocs are removed • Spring test framework removed, created custom mock implementation instead • Added class and method renamed
Diffstat (limited to 'src/test/java/org/traccar/helper/IpRetrieverTest.java')
-rw-r--r--src/test/java/org/traccar/helper/IpRetrieverTest.java38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/test/java/org/traccar/helper/IpRetrieverTest.java b/src/test/java/org/traccar/helper/IpRetrieverTest.java
deleted file mode 100644
index 63e2c0073..000000000
--- a/src/test/java/org/traccar/helper/IpRetrieverTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.traccar.helper;
-
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.mock.web.MockHttpServletRequest;
-
-import static org.junit.Assert.assertEquals;
-
-public class IpRetrieverTest {
-
- private static final String NORMAL_IP_ADDRESS = "231.23.45.65";
- private static final String GATEWAY_IP_ADDRESS = "147.120.1.5";
- private static final String IP_ADDRESS_BEHIND_REVERSE_PROXY = "231.23.45.65, 10.20.10.33, 10.20.20.34";
-
- private MockHttpServletRequest mockHttpServletRequest;
-
- @Before
- public void init() {
- mockHttpServletRequest = new MockHttpServletRequest();
- }
-
- @Test
- public void testIpBehindReverseProxy() {
- mockHttpServletRequest.setRemoteAddr(GATEWAY_IP_ADDRESS);
- mockHttpServletRequest.addHeader("X-FORWARDED-FOR", IP_ADDRESS_BEHIND_REVERSE_PROXY);
-
- assertEquals(NORMAL_IP_ADDRESS, IpRetriever.retrieveIP(mockHttpServletRequest));
- }
-
- @Test
- public void testNormalIp() {
- mockHttpServletRequest.setRemoteAddr(NORMAL_IP_ADDRESS);
- assertEquals(NORMAL_IP_ADDRESS, IpRetriever.retrieveIP(mockHttpServletRequest));
-
- }
-
-}