use of com.octo.android.robospice.retrofit.test.model.WeatherResult in project robospice by stephanenicolas.
the class JsonObjectPersisterFactoryTest method test_removeDataFromCache_when_two_requests_in_cache_and_one_removed.
public void test_removeDataFromCache_when_two_requests_in_cache_and_one_removed() throws Exception {
// GIVEN
WeatherResult weatherRequestStatus = buildWeather(TEST_TEMP, TEST_TEMP_UNIT);
final String fileName = "toto";
inFileObjectPersister.saveDataToCacheAndReturnData(weatherRequestStatus, fileName);
WeatherResult weatherRequestStatus2 = buildWeather(TEST_TEMP2, TEST_TEMP_UNIT);
final String fileName2 = "tutu";
inFileObjectPersister.saveDataToCacheAndReturnData(weatherRequestStatus2, fileName2);
inFileObjectPersister.removeDataFromCache(fileName2);
// WHEN
List<WeatherResult> listWeatherResult = inFileObjectPersister.loadAllDataFromCache();
// THEN
assertNotNull(listWeatherResult);
assertEquals(1, listWeatherResult.size());
assertTrue(listWeatherResult.contains(weatherRequestStatus));
assertFalse(listWeatherResult.contains(weatherRequestStatus2));
}
use of com.octo.android.robospice.retrofit.test.model.WeatherResult in project robospice by stephanenicolas.
the class RetrofitGsonSpiceServiceTest method test_addRequest_injects_request_factory.
public void test_addRequest_injects_request_factory() throws InterruptedException {
// given
spiceManager.start(getContext());
RetrofitSpiceRequestStub retrofitSpiceRequestStub = new RetrofitSpiceRequestStub(WeatherResult.class);
// when
spiceManager.execute(retrofitSpiceRequestStub, new RequestListenerStub<WeatherResult>());
retrofitSpiceRequestStub.await(REQUEST_COMPLETION_TIMEOUT);
// test
assertNotNull(retrofitSpiceRequestStub.getService());
}
use of com.octo.android.robospice.retrofit.test.model.WeatherResult in project robospice by stephanenicolas.
the class RetrofitJackson2SpiceServiceTest method test_addRequest_injects_request_factory.
public void test_addRequest_injects_request_factory() throws InterruptedException {
// given
spiceManager.start(getContext());
RetrofitSpiceRequestStub retrofitSpiceRequestStub = new RetrofitSpiceRequestStub(WeatherResult.class);
// when
spiceManager.execute(retrofitSpiceRequestStub, new RequestListenerStub<WeatherResult>());
retrofitSpiceRequestStub.await(REQUEST_COMPLETION_TIMEOUT);
// test
assertNotNull(retrofitSpiceRequestStub.getService());
}
use of com.octo.android.robospice.retrofit.test.model.WeatherResult in project robospice by stephanenicolas.
the class JsonObjectPersisterFactoryTest method test_loadAllDataFromCache_with_one_request_in_cache.
public void test_loadAllDataFromCache_with_one_request_in_cache() throws Exception {
// GIVEN
WeatherResult weatherRequestStatus = buildWeather(TEST_TEMP, TEST_TEMP_UNIT);
final String fileName = "toto";
inFileObjectPersister.saveDataToCacheAndReturnData(weatherRequestStatus, fileName);
// WHEN
List<WeatherResult> listWeatherResult = inFileObjectPersister.loadAllDataFromCache();
// THEN
assertNotNull(listWeatherResult);
assertEquals(1, listWeatherResult.size());
assertEquals(weatherRequestStatus, listWeatherResult.get(0));
}
use of com.octo.android.robospice.retrofit.test.model.WeatherResult in project robospice by stephanenicolas.
the class JsonObjectPersisterFactoryTest method test_loadAllDataFromCache_with_two_requests_in_cache.
public void test_loadAllDataFromCache_with_two_requests_in_cache() throws Exception {
// GIVEN
WeatherResult weatherRequestStatus = buildWeather(TEST_TEMP, TEST_TEMP_UNIT);
final String fileName = "toto";
inFileObjectPersister.saveDataToCacheAndReturnData(weatherRequestStatus, fileName);
WeatherResult weatherRequestStatus2 = buildWeather(TEST_TEMP2, TEST_TEMP_UNIT);
final String fileName2 = "tutu";
inFileObjectPersister.saveDataToCacheAndReturnData(weatherRequestStatus2, fileName2);
// WHEN
List<WeatherResult> listWeatherResult = inFileObjectPersister.loadAllDataFromCache();
// THEN
assertNotNull(listWeatherResult);
assertEquals(2, listWeatherResult.size());
assertTrue(listWeatherResult.contains(weatherRequestStatus));
assertTrue(listWeatherResult.contains(weatherRequestStatus2));
}
Aggregations