package com.battlelancer.seriesguide.sync;

import android.os.Bundle;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

@RunWith(AndroidJUnit4.class)
public class TvdbSyncTest {

    @Test
    public void test_singleNoId() {
        Bundle args = new Bundle();
        args.putInt(SgSyncAdapter.EXTRA_SYNC_TYPE, TvdbSync.SyncType.SINGLE.id);

        TvdbSync tvdbSync = new TvdbSync(args);

        assertThat(tvdbSync.syncType(), is(TvdbSync.SyncType.SINGLE));
        assertThat(tvdbSync.sync(null, null, 0), equalTo(null));
        assertThat(tvdbSync.hasUpdatedShows(), is(false));
    }
}

@@ -63,16 +63,156 @@
 Bundle;%0A
+import android.support.annotation.NonNull;%0Aimport android.support.annotation.Nullable;%0Aimport android.support.test.InstrumentationRegistry;%0A
 import a
@@ -564,115 +564,408 @@
     
-Bundle args = new Bundle();%0A        args.putInt(SgSyncAdapter.EXTRA_SYNC_TYPE, TvdbSync.SyncType.SINGLE.id)
+TvdbSync.SyncType syncType = TvdbSync.SyncType.SINGLE;%0A%0A        TvdbSync tvdbSync = new TvdbSync(syncArgs(syncType.id));%0A        assertThat(tvdbSync.syncType(), is(syncType));%0A%0A        assertThat(sync(tvdbSync), equalTo(null));%0A        assertThat(tvdbSync.hasUpdatedShows(), is(false));%0A    %7D%0A%0A    @Test%0A    public void test_fullNoShows() %7B%0A        TvdbSync.SyncType syncType = TvdbSync.SyncType.FULL
 ;%0A%0A 
@@ -1008,12 +1008,29 @@
 ync(
-args
+syncArgs(syncType.id)
 );%0A%0A
@@ -1076,36 +1076,344 @@
  is(
-TvdbSync.SyncType.SINGLE
+syncType));%0A        assertThat(sync(tvdbSync), equalTo(SgSyncAdapter.UpdateResult.SUCCESS));%0A        assertThat(tvdbSync.hasUpdatedShows(), is(false));%0A    %7D%0A%0A    @Test%0A    public void test_deltaNoShows() %7B%0A        TvdbSync.SyncType syncType = TvdbSync.SyncType.DELTA;%0A%0A        TvdbSync tvdbSync = new TvdbSync(syncArgs(syncType.id
 ));%0A
+%0A
     
@@ -1444,98 +1444,544 @@
 sync
-(null, null, 0), equalTo(null));%0A        assertThat(tvdbSync.hasUpdatedShows(), is(false))
+Type(), is(syncType));%0A        assertThat(sync(tvdbSync), equalTo(SgSyncAdapter.UpdateResult.SUCCESS));%0A        assertThat(tvdbSync.hasUpdatedShows(), is(false));%0A    %7D%0A%0A    @Nullable%0A    private SgSyncAdapter.UpdateResult sync(TvdbSync tvdbSync) %7B%0A        return tvdbSync.sync(InstrumentationRegistry.getContext(), null,%0A                System.currentTimeMillis());%0A    %7D%0A%0A    @NonNull%0A    private Bundle syncArgs(int id) %7B%0A        Bundle args = new Bundle();%0A        args.putInt(SgSyncAdapter.EXTRA_SYNC_TYPE, id);%0A        return args
 ;%0A  

Add some additional TvdbSync tests.