diff options
author | Daniel <djr2468@gmail.com> | 2023-04-05 22:27:02 +0100 |
---|---|---|
committer | Daniel <djr2468@gmail.com> | 2023-04-05 22:27:02 +0100 |
commit | c0dd2a6187de517af33aa92e0524414e65d973b4 (patch) | |
tree | 20afcdd6233940a30a4cf8dee6aaa09e6d3fdf21 /src/test/java/org/traccar/helper/ServletHelperTest.java | |
parent | a710ddd5ad336cd45d3a0e69f13985db840763dc (diff) | |
download | trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.tar.gz trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.tar.bz2 trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.zip |
Rename ServletHelper to WebHelper
Diffstat (limited to 'src/test/java/org/traccar/helper/ServletHelperTest.java')
-rw-r--r-- | src/test/java/org/traccar/helper/ServletHelperTest.java | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/test/java/org/traccar/helper/ServletHelperTest.java b/src/test/java/org/traccar/helper/ServletHelperTest.java deleted file mode 100644 index 3a645bc36..000000000 --- a/src/test/java/org/traccar/helper/ServletHelperTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.traccar.helper; - -import org.junit.jupiter.api.Test; - -import javax.servlet.http.HttpServletRequest; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ServletHelperTest { - - @Test - public void testRetrieveRemoteAddressProxyMultiple() { - HttpServletRequest request = mock(HttpServletRequest.class); - when(request.getRemoteAddr()).thenReturn("147.120.1.5"); - when(request.getHeader("X-FORWARDED-FOR")).thenReturn("231.23.45.65, 10.20.10.33, 10.20.20.34"); - - assertEquals("231.23.45.65", ServletHelper.retrieveRemoteAddress(request)); - } - - @Test - public void testRetrieveRemoteAddressProxySingle() { - HttpServletRequest request = mock(HttpServletRequest.class); - when(request.getRemoteAddr()).thenReturn("147.120.1.5"); - when(request.getHeader("X-FORWARDED-FOR")).thenReturn("231.23.45.65"); - - assertEquals("231.23.45.65", ServletHelper.retrieveRemoteAddress(request)); - } - - @Test - public void testRetrieveRemoteAddressNoProxy() { - HttpServletRequest request = mock(HttpServletRequest.class); - when(request.getRemoteAddr()).thenReturn("231.23.45.65"); - - assertEquals("231.23.45.65", ServletHelper.retrieveRemoteAddress(request)); - } - -} |