// Path: cachebank/src/test/java/net/jspiner/cachebank/datasource/CarDataSource.java
// public class CarDataSource implements DataSource<String, CarModel> {
// 
//     @Override
//     public void fetchData(String key, DataEmitter<CarModel> emitter) {
//         emitter.emit(
//                 DummyNetwork.requestCar(key)
//         );
//     }
// 
// }
// 
// Path: cachebank/src/test/java/net/jspiner/cachebank/model/CarModel.java
// public class CarModel {
// 
//     public int index;
//     public String carName;
// 
//     public CarModel(){
// 
//     }
// 
//     public CarModel(int index, String carName){
//         this.index = index;
//         this.carName = carName;
//     }
// 
// }
// 
// Path: cachebank/src/test/java/net/jspiner/cachebank/model/FoodModel.java
// public class FoodModel{
// 
//     public int index;
//     public String foodName;
// 
//     public FoodModel(){
// 
//     }
// 
//     public FoodModel(int index, String foodName){
//         this.index = index;
//         this.foodName = foodName;
//     }
// }


import net.jspiner.cachebank.datasource.CarDataSource;
import net.jspiner.cachebank.model.CarModel;
import net.jspiner.cachebank.model.FoodModel;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;
package net.jspiner.cachebank;





/**
 * Created by JSpiner on 2017. 7. 14..
 * JSpiner
 * Contact : jspiner@naver.com
 */

public class ExpireTest {

    @Before
    public void before(){
        new Bank.Builder()
                .setMemCacheSize(1000 * 24)
                .init();

        Assert.assertTrue(Bank.isInitialized());
    }

    @After
    public void tearDown(){
        Bank.clear();
        Bank.terminate();

        Assert.assertFalse(Bank.isInitialized());
    }

    @Test
    public void expireTest() throws InterruptedException {
        Bank.deposit(new CarModel(9986, "avante-new"), "avante").now();

        Thread.sleep(1000 * 2);

        CarModel carModel = Bank.withdrawal(CarModel.class, "avante")
// Path: cachebank/src/test/java/net/jspiner/cachebank/datasource/CarDataSource.java
// public class CarDataSource implements DataSource<String, CarModel> {
// 
//     @Override
//     public void fetchData(String key, DataEmitter<CarModel> emitter) {
//         emitter.emit(
//                 DummyNetwork.requestCar(key)
//         );
//     }
// 
// }
// 
// Path: cachebank/src/test/java/net/jspiner/cachebank/model/CarModel.java
// public class CarModel {
// 
//     public int index;
//     public String carName;
// 
//     public CarModel(){
// 
//     }
// 
//     public CarModel(int index, String carName){
//         this.index = index;
//         this.carName = carName;
//     }
// 
// }
// 
// Path: cachebank/src/test/java/net/jspiner/cachebank/model/FoodModel.java
// public class FoodModel{
// 
//     public int index;
//     public String foodName;
// 
//     public FoodModel(){
// 
//     }
// 
//     public FoodModel(int index, String foodName){
//         this.index = index;
//         this.foodName = foodName;
//     }
// }


// Path: cachebank/src/test/java/net/jspiner/cachebank/ExpireTest.java
import net.jspiner.cachebank.datasource.CarDataSource;
import net.jspiner.cachebank.model.CarModel;
import net.jspiner.cachebank.model.FoodModel;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;

package net.jspiner.cachebank;





/**
 * Created by JSpiner on 2017. 7. 14..
 * JSpiner
 * Contact : jspiner@naver.com
 */

public class ExpireTest {

    @Before
    public void before(){
        new Bank.Builder()
                .setMemCacheSize(1000 * 24)
                .init();

        Assert.assertTrue(Bank.isInitialized());
    }

    @After
    public void tearDown(){
        Bank.clear();
        Bank.terminate();

        Assert.assertFalse(Bank.isInitialized());
    }

    @Test
    public void expireTest() throws InterruptedException {
        Bank.deposit(new CarModel(9986, "avante-new"), "avante").now();

        Thread.sleep(1000 * 2);

        CarModel carModel = Bank.withdrawal(CarModel.class, "avante")
                .dataSource(new CarDataSource()).now();