@Test public void shouldPrefixGerenciadorForPackagedControllers() { assertThat("/gerenciador", is(equalTo(cprp.prefixGerenciador(UsuarioController.class, "")))); assertThat("/gerenciador/", is(equalTo(cprp.prefixGerenciador(UsuarioController.class, "/")))); assertThat( "/gerenciador/bla", is(equalTo(cprp.prefixGerenciador(UsuarioController.class, "/bla")))); }
@Test public void shouldPrefixGerenciadorPlusControllerNameWhenFixingSlashUri() { String[] uris = {"/"}; String[] fixedUris = {"/gerenciador/"}; cprp.fixURIs(UsuarioController.class, uris); assertThat(uris, is(equalTo(fixedUris))); }
@Test public void shouldFixLeadingSlash() { String[] uris = {"bark"}; String[] fixedUris = {"/dog/bark"}; cprp.fixURIs(DogController.class, uris); assertThat(uris, is(equalTo(fixedUris))); }
@Test public void shouldOmitControllerNameFixingRootControllerUris() { String[] uris = {"", "/", "login", "/login"}; String[] fixedUris = { "/gerenciador/", "/gerenciador/", "/gerenciador/login", "/gerenciador/login" }; cprp.fixURIs(br.com.integrativa.icms.controller.RootController.class, uris); assertThat(uris, is(equalTo(fixedUris))); }
@Test public void shouldDefaultUriToVraptorConventionOtherwise() { assertThat(cprp.defaultUriFor("/", "sitemap"), is(equalTo("/sitemap"))); assertThat(cprp.defaultUriFor("/dog", "bark"), is(equalTo("/dog/bark"))); }
@Test public void shouldDefaultForEmptyPathWhenMethodNameIsIndex() { assertThat(cprp.defaultUriFor("/", "index"), is(equalTo("/"))); assertThat(cprp.defaultUriFor("/login", "index"), is(equalTo("/login"))); }
@Test public void shouldExtractControllerNameToVraptorConventionOtherwise() { assertThat(cprp.extractControllerNameFrom(DogController.class), is(equalTo("/dog"))); }
@Test public void shouldExtractEmptyStringForRootController() { assertThat( cprp.extractControllerNameFrom(br.com.integrativa.bogus.controller.RootController.class), is(equalTo("/"))); }