@Test public void shouldCallOnFailureWhenParseRespError() throws Exception { songsGateway.querySongsByChannelId(ReportType.NEXT_QUEUE, "1", 10, ChannelConstantIds.PRIVATE_CHANNEL, BitRate.HIGH, new Callback()); apiGateway.simulateTextResponse(200, TestResponses.NULL_RESP, null); TestCase.assertNotNull(songsGateway.failureResponse); assertThat(douban.mApiRespErrorCode.getCode(), equalTo(ApiInternalError.INTERNAL_ERROR.getCode())); }
public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) { if(channelId== ChannelConstantIds.PRIVATE_CHANNEL ||channelId== ChannelConstantIds.FAV){ this.isAuthRequire=true; } apiGateway.makeRequest(new SongsRequest(channelId, bitRate, songType,currentSongId, playTime), new SongApiResponseCallback(callback, this, douban)); }
SongsGateway extends BaseApiGateway { public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) { if(channelId== ChannelConstantIds.PRIVATE_CHANNEL ||channelId== ChannelConstantIds.FAV){ this.isAuthRequire=true; } apiGateway.makeRequest(new SongsRequest(channelId, bitRate, songType,currentSongId, playTime), new SongApiResponseCallback(callback, this, douban)); } }
SongsGateway extends BaseApiGateway { public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) { if(channelId== ChannelConstantIds.PRIVATE_CHANNEL ||channelId== ChannelConstantIds.FAV){ this.isAuthRequire=true; } apiGateway.makeRequest(new SongsRequest(channelId, bitRate, songType,currentSongId, playTime), new SongApiResponseCallback(callback, this, douban)); } SongsGateway(Douban douban, ApiGateway apiGateway); }
SongsGateway extends BaseApiGateway { public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) { if(channelId== ChannelConstantIds.PRIVATE_CHANNEL ||channelId== ChannelConstantIds.FAV){ this.isAuthRequire=true; } apiGateway.makeRequest(new SongsRequest(channelId, bitRate, songType,currentSongId, playTime), new SongApiResponseCallback(callback, this, douban)); } SongsGateway(Douban douban, ApiGateway apiGateway); void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback); }
SongsGateway extends BaseApiGateway { public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) { if(channelId== ChannelConstantIds.PRIVATE_CHANNEL ||channelId== ChannelConstantIds.FAV){ this.isAuthRequire=true; } apiGateway.makeRequest(new SongsRequest(channelId, bitRate, songType,currentSongId, playTime), new SongApiResponseCallback(callback, this, douban)); } SongsGateway(Douban douban, ApiGateway apiGateway); void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback); static final Gson GSON; }