@@ -0,0 +1,2210 @@
+package br.com.caelum.vraptor.musicjungle.acceptance;%0A%0Aimport static br.com.caelum.vraptor.musicjungle.enums.MusicType.CLASSICAL;%0Aimport static org.hamcrest.Matchers.containsString;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport br.com.caelum.vraptor.musicjungle.acceptance.infra.AcceptanceTestCase;%0Aimport br.com.caelum.vraptor.musicjungle.acceptance.pages.LoginPage;%0Aimport br.com.caelum.vraptor.musicjungle.acceptance.pages.MusicPage;%0Aimport br.com.caelum.vraptor.musicjungle.acceptance.pages.SearchPage;%0Aimport br.com.caelum.vraptor.musicjungle.model.Music;%0A%0A%0Apublic class RoutesTest extends AcceptanceTestCase %7B%0A%0A%09private LoginPage loginPage;%0A%09private Music music;%0A%09private String userName;%0A%0A%09@Before%0A%09public void setUp() %7B%0A%09%09this.loginPage = loginPage();%0A%09%09this.userName = %22vraptortest%22;%0A%09%09loginPage.loginAsUser(userName);%0A%09%09this.music = new Music(%22Mozart - Symphony #40%22, %22Mozart%22, CLASSICAL);%0A%09%09acceptanceData().addMusic(music);%0A%09%09loginPage.logout();%0A%09%7D%0A%0A%09@Test%0A%09public void shouldHandleAllRoutesTypes() throws Exception %7B%0A%09%09// @Post testing default route /home/login %0A%09%09shouldAccessPostMethodWithDefaultURLValue();%0A%09%09// @Get(/musics/search)%0A%09%09shouldAccessGetMethodWithADefinedValue();%0A%09%09// @Path(/musics/%7Bmusic.id%7D) @Get()%0A%09%09shouldAccessPathPlusGetMethodWithURLParameter();%0A%09%7D%0A%0A%09private void shouldAccessPathPlusGetMethodWithURLParameter() %7B%0A%09%09MusicPage musicPage = homePage().clickOnFirstMusic();%0A%09%09String source = musicPage.pageSource();%0A%09%09assertPageContains(source, music.getTitle(), %22Owners:%22, userName);%0A%09%7D%0A%0A%09private void shouldAccessGetMethodWithADefinedValue() %7B%0A%09%09loginPage.loginAsUser(userName);%0A%09%09String musicTitle = music.getTitle();%0A%09%09SearchPage searchPage = homePage().searchFor(musicTitle);%0A%09%09String source = searchPage.pageSource();%0A%09%09assertPageContains(source, %22Search results%22, musicTitle);%0A%09%7D%0A%0A%09private void shouldAccessPostMethodWithDefaultURLValue() %7B%0A%09%09String source = loginPage.pageSource();%0A%09%09assertPageContains(source, %22VRaptor Music Jungle%22, %22Sign In%22);%0A%09%7D%0A%0A%09private void assertPageContains(String source, String ...args) %7B%0A%09%09for (String expectedText : args) %7B%0A%09%09%09assertThat(source, containsString(expectedText));%0A%09%09%7D%0A%09%7D%0A%0A%7D

Add Route Tests