public void testGetCurrentEntryPoint_withBranding() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); // register a branding with the default servlet name ("rap") RWTFactory.getBrandingManager().register(new TestBranding("rap", null, "foo")); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testGetCurrentEntryPoint_servletPathOverridesBranding() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); RWTFactory.getBrandingManager().register(new TestBranding("rap", null, "foo")); IEntryPoint entryPointByPath = mockEntryPoint(); IEntryPointFactory entryPointFactoryByPath = mockEntryPointFactory(entryPointByPath); RWTFactory.getEntryPointManager().registerByPath("/rap", entryPointFactoryByPath, null); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); // Servlet path takes precedence over branding verify(entryPointFactory, times(0)).create(); verify(entryPointFactoryByPath).create(); assertSame(entryPointByPath, result); }