finished work on simple live app request mappings symbols

This commit is contained in:
Martin Lippert
2017-10-25 10:38:54 +02:00
parent e27aece3f8
commit 3bcc9091b2
4 changed files with 108 additions and 12 deletions

View File

@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2017 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.java.requestmapping.test;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.ide.vscode.boot.java.requestmapping.UrlUtil;
/**
* @author Martin Lippert
*/
public class UrlUtilTest {
@Test
public void testSplitPathWithoutDuplicate() {
String path = "/superpath";
String[] splitPath = UrlUtil.splitPath(path);
assertEquals(1, splitPath.length);
assertEquals("/superpath", splitPath[0]);
}
@Test
public void testSplitPathSimpleCaseWithEmptyOr() {
String path = "/superpath/mypath || ";
String[] splitPath = UrlUtil.splitPath(path);
assertEquals(1, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
}
@Test
public void testSplitPathSimpleCase() {
String path = "/superpath/mypath || mypath.json";
String[] splitPath = UrlUtil.splitPath(path);
assertEquals(2, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
assertEquals("/superpath/mypath.json", splitPath[1]);
}
@Test
public void testSplitPathMultipleCases() {
String path = "/superpath/mypath || mypath.json || somethingelse.what";
String[] splitPath = UrlUtil.splitPath(path);
assertEquals(3, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
assertEquals("/superpath/mypath.json", splitPath[1]);
assertEquals("/superpath/somethingelse.what", splitPath[2]);
}
}