@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); }
@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()); }