added userAgentStartsWith method to HttpUtil

This commit is contained in:
Sebastian Sdorra
2014-03-16 11:45:43 +01:00
parent 9db7284f27
commit d0c94963ee
2 changed files with 41 additions and 0 deletions

View File

@@ -184,6 +184,23 @@ public class HttpUtilTest
}
/**
* Method description
*
*/
@Test
public void userAgentStartsWithTest()
{
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getHeader(HttpUtil.HEADER_USERAGENT)).thenReturn(
"git/1.7.10.5997.gaa4aa");
assertTrue(HttpUtil.userAgentStartsWith(request, "git/"));
assertTrue(HttpUtil.userAgentStartsWith(request, "GIT/"));
assertFalse(HttpUtil.userAgentStartsWith(request, "git/a"));
assertFalse(HttpUtil.userAgentStartsWith(request, "sobbo/"));
}
//~--- get methods ----------------------------------------------------------
/**