<commit_before>package com.github.felipehjcosta.marvelapp.cache

import android.arch.persistence.room.Room.inMemoryDatabaseBuilder
import android.support.test.InstrumentationRegistry.getTargetContext
import android.support.test.runner.AndroidJUnit4
import com.github.felipehjcosta.marvelapp.cache.data.CharacterRelations
import com.github.felipehjcosta.marvelapp.cache.data.CharactersDao
import com.github.felipehjcosta.marvelapp.cache.data.SummaryEntity
import com.github.felipehjcosta.marvelapp.cache.data.UrlEntity
import io.reactivex.observers.TestObserver
import org.junit.After
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit

@RunWith(AndroidJUnit4::class)
class CacheDatabaseTest {

    private val cacheDatabase: CacheDatabase = inMemoryDatabaseBuilder(getTargetContext(),
            CacheDatabase::class.java).build()
    private val charactersDao: CharactersDao = cacheDatabase.charactersDao()

    @After
    fun tearDown() {
        cacheDatabase.close()
    }

    @Test
    fun ensureEmptyCharacterEntityByIdWhenDataDoesNotExist() {

        val itemsObserver = TestObserver.create<CharacterRelations>()

        charactersDao.findById(42L).subscribe(itemsObserver)

        itemsObserver.await(500L, TimeUnit.MILLISECONDS)
        itemsObserver.assertNoValues()<commit_msg>Ignore instrumentation tests of cache module<commit_after>package com.github.felipehjcosta.marvelapp.cache

import android.arch.persistence.room.Room.inMemoryDatabaseBuilder
import android.support.test.InstrumentationRegistry.getTargetContext
import android.support.test.runner.AndroidJUnit4
import com.github.felipehjcosta.marvelapp.cache.data.CharacterRelations
import com.github.felipehjcosta.marvelapp.cache.data.CharactersDao
import com.github.felipehjcosta.marvelapp.cache.data.SummaryEntity
import com.github.felipehjcosta.marvelapp.cache.data.UrlEntity
import io.reactivex.observers.TestObserver
import org.junit.After
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit

@RunWith(AndroidJUnit4::class)
@Ignore
class CacheDatabaseTest {

    private val cacheDatabase: CacheDatabase = inMemoryDatabaseBuilder(getTargetContext(),
            CacheDatabase::class.java).build()
    private val charactersDao: CharactersDao = cacheDatabase.charactersDao()

    @After
    fun tearDown() {
        cacheDatabase.close()
    }

    @Test
    fun ensureEmptyCharacterEntityByIdWhenDataDoesNotExist() {

        val itemsObserver = TestObserver.create<CharacterRelations>()

        charactersDao.findById(42L).subscribe(itemsObserver)

        itemsObserver.await(500L, TimeUnit.MILLISECONDS)
        itemsObserver.assertNoValues()
{'fraction_non_alphanumeric': 0.0839135214364236, 'fraction_numerical': 0.005130084279956028, 'mean_word_length': 5.275862068965517, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '685199', 'n_tokens_mistral': 797, 'n_tokens_neox': 789, 'n_words': 115}