<commit_before>/*
 * Copyright (c) 2017 大前良介 (OHMAE Ryosuke)
 *
 * This software is released under the MIT License.
 * http://opensource.org/licenses/MIT
 */

package net.mm2d.dmsexplorer.util.update;

import android.content.Context;

import net.mm2d.dmsexplorer.settings.Settings;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

/**
 * @author <a href="mailto:<EMAIL>">大前良介 (OHMAE Ryosuke)</a>
 */
@RunWith(RobolectricTestRunner.class)
public class UpdateCheckerTest {
    @Test
    public void isUpdateAvailable_異常な入力ならfalse() throws Exception {
        final Context context = RuntimeEnvironment.application;
        final Settings settings = mock(Settings.class);
        final int version = 715;
        final String json1 = "{\"mobile\":{\"versionCode\":716,\"targetInclude\":[0],\"targetExclude\":[]}}";
        assertThat(new UpdateChecker(context, settings, version).isUpdateAvailable(json1), is(false));
        final String json2 = "{\"mobile\":{\"versionName\":\"0.7.16\",\"versionCode\":716,\"targetInclude\":[0],\"targetExclude\":[]}";<commit_msg>add annotation<commit_after>/*
 * Copyright (c) 2017 大前良介 (OHMAE Ryosuke)
 *
 * This software is released under the MIT License.
 * http://opensource.org/licenses/MIT
 */

package net.mm2d.dmsexplorer.util.update;

import android.content.Context;

import net.mm2d.dmsexplorer.settings.Settings;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

/**
 * @author <a href="mailto:<EMAIL>">大前良介 (OH<NAME>)</a>
 */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class UpdateCheckerTest {
    @Test
    public void isUpdateAvailable_異常な入力ならfalse() throws Exception {
        final Context context = RuntimeEnvironment.application;
        final Settings settings = mock(Settings.class);
        final int version = 715;
        final String json1 = "{\"mobile\":{\"versionCode\":716,\"targetInclude\":[0],\"targetExclude\":[]}}";
        assertThat(new UpdateChecker(context, settings, version).isUpdateAvailable(json1), is(false));
        final String json2 = "{\"mobile\":{\"versionName\":\"0.7.16\",\"versionCode\":716,\"targetInclude\":[0],\"targetExclude\":[]}";
{'fraction_non_alphanumeric': 0.15275650842266464, 'fraction_numerical': 0.018376722817764167, 'mean_word_length': 4.631465517241379, 'pattern_counts': {'":': 18, '<': 10, '<?xml version=': 0, '>': 10, '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': '7394293', 'n_tokens_mistral': 854, 'n_tokens_neox': 825, 'n_words': 161}