Ejemplo n.º 1
0
  @Test
  public void testGetWithoutIndexJson() throws IOException {
    TabrisResourceLoader loader = new TabrisResourceLoader(applicationContext);
    Collection<String> paths = createPathList();
    when(manager.getServletPaths()).thenReturn(paths);

    InputStream stream = loader.getResourceAsStream("index.json2");

    assertNull(stream);
  }
Ejemplo n.º 2
0
  @Test
  public void testGetEntryPointsWithIndexJson() throws IOException, JSONException {
    TabrisResourceLoader loader = new TabrisResourceLoader(applicationContext);
    Collection<String> paths = createPathList();
    when(manager.getServletPaths()).thenReturn(paths);

    InputStream stream = loader.getResourceAsStream("index.json");

    JSONArray points = getEntryPointArray(stream);
    assertEquals("../test", points.getJSONObject(0).getString(TabrisResourceLoader.KEY_PATH));
    assertEquals("../test2", points.getJSONObject(1).getString(TabrisResourceLoader.KEY_PATH));
    assertEquals(2, points.length());
  }