| | |
| | | */
|
| | | package com.gitblit.tests;
|
| | |
|
| | | import static org.junit.Assert.assertEquals;
|
| | | import static org.junit.Assert.assertFalse;
|
| | | import static org.junit.Assert.assertTrue;
|
| | |
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | public class StringUtilsTest {
|
| | | public class StringUtilsTest extends GitblitUnitTest {
|
| | |
|
| | | @Test
|
| | | public void testIsEmpty() throws Exception {
|
| | |
| | | public void testEscapeForHtml() throws Exception {
|
| | | String input = "& < > \" \t";
|
| | | String outputNoChange = "& < > " \t";
|
| | | String outputChange = "& < > " ";
|
| | | String outputChange = "& < > " ";
|
| | | assertEquals(outputNoChange, StringUtils.escapeForHtml(input, false));
|
| | | assertEquals(outputChange, StringUtils.escapeForHtml(input, true));
|
| | | }
|
| | |
| | | assertFalse(StringUtils.fuzzyMatch("123", "12345"));
|
| | | assertFalse(StringUtils.fuzzyMatch("AbCdEfHIJ", "abc*hhh"));
|
| | | }
|
| | | |
| | |
|
| | | @Test
|
| | | public void testGetRepositoryPath() throws Exception {
|
| | | assertEquals("gitblit/gitblit.git", StringUtils.extractRepositoryPath("git://github.com/gitblit/gitblit.git", new String [] { ".*?://github.com/(.*)" }));
|