コード例 #1
0
  @Test
  public void resolve_exactPath() {
    when(request.path()).thenReturn("/stores");

    Path path = pathResolver.resolve(request);
    Assert.assertNotNull(path);

    Assert.assertEquals("/stores", path.getPath());
  }
コード例 #2
0
  @Test
  public void resolve_root() {
    when(request.path()).thenReturn("/myapi");

    Path path = pathResolver.resolve(request);
    Assert.assertNotNull(path);

    Assert.assertEquals("/", path.getPath());
  }
コード例 #3
0
  @Test
  public void resolve_noParameterizedPath_checkChildren() {
    when(request.path()).thenReturn("/products/99/data");

    Path path = pathResolver.resolve(request);
    Assert.assertNotNull(path);

    Assert.assertEquals("/products", path.getPath());
  }
コード例 #4
0
  @Test
  public void resolve_pathParameterizedPath_mustReturnRoot2() {
    when(request.path()).thenReturn("/weather_invalidpath");

    Path path = pathResolver.resolve(request);
    Assert.assertNotNull(path);

    Assert.assertEquals("/", path.getPath());
  }
コード例 #5
0
  @Test
  public void resolve_pathParameterizedPath() {
    when(request.path()).thenReturn("/stores/99");

    Path path = pathResolver.resolve(request);
    Assert.assertNotNull(path);

    Assert.assertEquals("/stores/:storeId", path.getPath());
  }