Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a few tests broken by previous commit

  • Loading branch information...
commit 8d37cc8ee4878f1e74bb739edf1d7dac0c9f892a 1 parent 220600c
@nperrier nperrier authored
View
2  test/com/pugh/sockso/music/TrackTest.java
@@ -155,9 +155,11 @@ public void testCreateListFromResultSet() throws SQLException {
expect( rs.next() ).andReturn( true );
expect( rs.getInt("artistId") ).andReturn( -1 );
expect( rs.getString("artistName") ).andReturn( albumName );
+ expect( rs.getDate("artistDateAdded") ).andReturn( null ).times( 1 );
expect( rs.getInt("albumId") ).andReturn( -1 );
expect( rs.getString("albumName") ).andReturn( albumName );
expect( rs.getString("albumYear") ).andReturn( albumYear );
+ expect( rs.getDate("albumDateAdded") ).andReturn( null ).times( 1 );
expect( rs.getInt("genreId") ).andReturn( -1 );
expect( rs.getString("genreName") ).andReturn( genre );
expect( rs.getInt("trackId") ).andReturn( -1 );
View
2  test/com/pugh/sockso/web/JsonWriterTest.java
@@ -45,7 +45,7 @@ public void testIssue109() throws Exception {
tpl.setAlbums(albums);
tpl.makeRenderer().renderTo(jsonWriter);
- String expected = "[{\"id\":2,\"name\":\"Album\\\"\",\"artist\":{\"id\":1,\"name\":\"Artist\\\"\"}}]";
+ String expected = "[{\"id\":2,\"name\":\"Album\\\"\",\"date_added\":\"null\",\"artist\":{\"id\":1,\"name\":\"Artist\\\"\",\"date_added\":\"null\"}}]";
String actual = stringWriter.toString();
assertEquals( expected, actual );
View
9 test/com/pugh/sockso/web/RelatedArtistsTest.java
@@ -5,6 +5,7 @@
import com.pugh.sockso.tests.SocksoTestCase;
import com.pugh.sockso.tests.TestDatabase;
import com.pugh.sockso.web.action.AudioScrobbler;
+import java.util.List;
import static org.easymock.classextension.EasyMock.*;
@@ -24,12 +25,12 @@ protected void setUp() throws Exception {
}
public void testOnlyRelatedArtistsInCollectionAreReturned() throws Exception {
- Artist[] artists = related.getRelatedArtistsFor( 1 );
- assertEquals( 2, artists.length );
+ List<Artist> artists = related.getRelatedArtistsFor( 1 );
+ assertEquals( 2, artists.size() );
}
public void testArtistAddedDateIsReturnedWithArtistObjects() throws Exception {
- Artist[] artists = related.getRelatedArtistsFor( 1 );
- assertNotNull( artists[0].getDateAdded() );
+ List<Artist> artists = related.getRelatedArtistsFor( 1 );
+ assertNotNull( artists.get(0).getDateAdded() );
}
}
View
12 test/com/pugh/sockso/web/action/api/ArtistActionTest.java
@@ -38,12 +38,11 @@ public void testActionDoesntHandleUrlsNotForArtistInfo() {
assertFalse( action.canHandle(getRequest( "/api/albums/456" )) );
}
- public void testArtistAndAlbumInfoShowsWhenArtistRequested() throws Exception {
+ public void testArtistInfoShowsWhenArtistRequested() throws Exception {
action.setRequest(getRequest( "/api/artists/1" ));
action.handleRequest();
+ assertContains( res.getOutput(), "1");
assertContains( res.getOutput(), "A Artist" );
- assertContains( res.getOutput(), "A Album" );
- assertContains( res.getOutput(), "Empty Album" );
}
public void testExceptionThrownWhenInvalidArtistRequested() {
@@ -58,11 +57,4 @@ public void testExceptionThrownWhenInvalidArtistRequested() {
}
}
- public void testYearsAreListedWithTheArtistsAlbums() throws Exception {
- action.setRequest(getRequest( "/api/artists/1" ));
- action.handleRequest();
- assertContains( res.getOutput(), "1984" );
- assertContains( res.getOutput(), "1985" );
- }
-
}
View
11 test/com/pugh/sockso/web/action/api/ArtistRelatedActionTest.java
@@ -6,7 +6,10 @@
import com.pugh.sockso.tests.TestResponse;
import com.pugh.sockso.web.BadRequestException;
import com.pugh.sockso.web.RelatedArtists;
+
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import static org.easymock.classextension.EasyMock.*;
@@ -19,10 +22,10 @@
@Override
protected void setUp() throws Exception {
RelatedArtists related = createMock( RelatedArtists.class );
- Artist[] artists = new Artist[] {
- new Artist.Builder().id(1).name("FooFoo").dateAdded(new Date()).build(),
- new Artist.Builder().id(2).name("BarBar").dateAdded(new Date()).build()
- };
+ List<Artist> artists = new ArrayList<Artist>();
+ artists.add(new Artist.Builder().id(1).name("FooFoo").dateAdded(new Date()).build());
+ artists.add(new Artist.Builder().id(2).name("BarBar").dateAdded(new Date()).build());
+
expect( related.getRelatedArtistsFor(1) ).andReturn( artists );
expect( related.getRelatedArtistsFor(99) ).andThrow( new BadRequestException("") );
replay( related );
Please sign in to comment.
Something went wrong with that request. Please try again.