<commit_before>package org.commcare.backend.session.test;

import org.commcare.core.interfaces.UserSandbox;
import org.commcare.modern.session.SessionWrapper;
import org.commcare.session.SessionDescriptorUtil;
import org.commcare.session.SessionFrame;
import org.commcare.session.SessionNavigator;
import org.commcare.test.utilities.MockApp;
import org.commcare.test.utilities.MockSessionNavigationResponder;
import org.javarosa.form.api.FormEntryController;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created by ctsims on 12/2/2016
 */

public class InstanceEvaluationTests {

    private MockApp mApp;
    private MockSessionNavigationResponder mSessionNavigationResponder;
    private SessionNavigator sessionNavigator;

    @Before
    public void setUp() throws Exception {
        mApp = new MockApp("/mixed_instance_initializers/");
        mSessionNavigationResponder = new MockSessionNavigationResponder(mApp.getSession());
        sessionNavigator = new SessionNavigator(mSessionNavigationResponder);
        mApp.getSession().clearVolitiles();
    }

    /**
     * Testing cases where instances are used with different ID's in multiple contexts
     */
    @Test
    public void testMixedInstanceIdCaching() throws Exception {
        SessionWrapper session = mApp.getSession();

        sessionNavigator.startNextSessionStep();

        session.setCommand("m0");

        sessionNavigator.startNextSessionStep();

        session.setCommand("m0-f0");

        sessionNavigator.startNextSessionStep();

        FormEntryController fec = mApp.loadAndInitForm("form_placeholder.xml");

        Assert.assertTrue(fec.getModel().getEvent() == FormEntryController.EVENT_BEGINNING_OF_FORM);

        fec.stepToNextEvent();

        Assert.assertEquals("one",fec.getQuestionPrompts()[0].getQuestionText());
    }
}
<commit_msg>linting<commit_after>package org.commcare.backend.session.test;

import org.commcare.modern.session.SessionWrapper;
import org.commcare.session.SessionNavigator;
import org.commcare.test.utilities.MockApp;
import org.commcare.test.utilities.MockSessionNavigationResponder;
import org.javarosa.form.api.FormEntryController;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Created by ctsims on 12/2/2016
 */
public class InstanceEvaluationTests {

    private MockApp mApp;
    private SessionNavigator sessionNavigator;

    @Before
    public void setUp() throws Exception {
        mApp = new MockApp("/mixed_instance_initializers/");
        MockSessionNavigationResponder mockSessionNavigationResponder =
                new MockSessionNavigationResponder(mApp.getSession());
        sessionNavigator = new SessionNavigator(mockSessionNavigationResponder);
        mApp.getSession().clearVolitiles();
    }

    /**
     * Testing cases where instances are used with different ID's in multiple contexts
     */
    @Test
    public void testMixedInstanceIdCaching() throws Exception {
        SessionWrapper session = mApp.getSession();

        sessionNavigator.startNextSessionStep();

        session.setCommand("m0");

        sessionNavigator.startNextSessionStep();

        session.setCommand("m0-f0");

        sessionNavigator.startNextSessionStep();

        FormEntryController fec = mApp.loadAndInitForm("form_placeholder.xml");

        Assert.assertTrue(fec.getModel().getEvent() == FormEntryController.EVENT_BEGINNING_OF_FORM);

        fec.stepToNextEvent();

        Assert.assertEquals("one", fec.getQuestionPrompts()[0].getQuestionText());
    }
}

{'fraction_non_alphanumeric': 0.09671179883945841, 'fraction_numerical': 0.0060790273556231, 'mean_word_length': 4.098591549295775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3022499', 'n_tokens_mistral': 1032, 'n_tokens_neox': 976, 'n_words': 176}