Issue #4776 - Adding different length tests to WebSocketUriMappingTest

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-04-22 08:56:18 -05:00 committed by Ludovic Orban
parent 0234ead671
commit 5c2f00c1f5

View File

@ -167,4 +167,16 @@ public class WebSocketUriMappingTest
assertThat(getBestMatch("/a/b/c"), is("suffix2"));
}
@Test
public void testDifferentLengths()
{
mapping.put(new UriTemplatePathSpec("/a/{var}/c"), "endpointA");
mapping.put(new UriTemplatePathSpec("/a/{var}/c/d"), "endpointB");
mapping.put(new UriTemplatePathSpec("/a/{var1}/{var2}/d/e"), "endpointC");
assertThat(getBestMatch("/a/b/c"), is("endpointA"));
assertThat(getBestMatch("/a/d/c/d"), is("endpointB"));
assertThat(getBestMatch("/a/x/y/d/e"), is("endpointC"));
}
}