<commit_before>/*
 * Copyright 2006-2007,  Unitils.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.unitils.mock.core;

import static org.unitils.mock.ArgumentMatchers.notNull;

import java.io.IOException;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;
import org.unitils.core.UnitilsException;
import org.unitils.mock.mockbehavior.MockBehavior;
import org.unitils.mock.proxy.ProxyInvocation;

/**
 * todo javadoc
 *
 * @author <NAME>
 * @author <NAME>
 */
public class MockObjectInvalidSyntaxTest {

    /* Class under test */
    private MockObject<TestClass> mockObject1, mockObject2;


    @Before
    public void setUp() {
        Scenario scenario = new Scenario(null);
        mockObject1 = new MockObject<TestClass>("testMock1", TestClass.class, false, scenario);
        mockObject2 = new MockObject<TestClass>("testMock2", TestClass.class, false, scenario);
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_returns_followedBySecondBehaviorDefinition() {
        mockObject1.returns("aValue");
        mockObject2.returns("aValue");
    }

    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_returns_followedByActualInvocation() {
        mockObject1.returns("aValue");
        mockObject2.getMock().testMethod();
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_raises() {
        mockObject1.raises(new RuntimeException());
        mockObject2.returns("aValue");
    }


    @Test(expected = UnitilsException.class)
    @Ignore
    public void incompleteBehaviorDefinition_performs() {
        mockObject1.performs(new MockBehavior() {
            public Object execute(ProxyInvocation mockInvocation) throws Throwable {
                return null;
            }
        });
        mockObject2.assertInvoked();
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_onceReturns() {
        mockObject1.onceReturns("aValue");<commit_msg>Remoted @Ignore for succeeding test<commit_after>/*
 * Copyright 2006-2007,  Unitils.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.unitils.mock.core;

import static org.unitils.mock.ArgumentMatchers.notNull;

import java.io.IOException;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;
import org.unitils.core.UnitilsException;
import org.unitils.mock.mockbehavior.MockBehavior;
import org.unitils.mock.proxy.ProxyInvocation;

/**
 * todo javadoc
 *
 * @author <NAME>
 * @author <NAME>
 */
public class MockObjectInvalidSyntaxTest {

    /* Class under test */
    private MockObject<TestClass> mockObject1, mockObject2;


    @Before
    public void setUp() {
        Scenario scenario = new Scenario(null);
        mockObject1 = new MockObject<TestClass>("testMock1", TestClass.class, false, scenario);
        mockObject2 = new MockObject<TestClass>("testMock2", TestClass.class, false, scenario);
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_returns_followedBySecondBehaviorDefinition() {
        mockObject1.returns("aValue");
        mockObject2.returns("aValue");
    }

    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_returns_followedByActualInvocation() {
        mockObject1.returns("aValue");
        mockObject2.getMock().testMethod();
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_raises() {
        mockObject1.raises(new RuntimeException());
        mockObject2.returns("aValue");
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_performs() {
        mockObject1.performs(new MockBehavior() {
            public Object execute(ProxyInvocation mockInvocation) throws Throwable {
                return null;
            }
        });
        mockObject2.assertInvoked();
    }


    @Test(expected = UnitilsException.class)
    public void incompleteBehaviorDefinition_onceReturns() {
        mockObject1.onceReturns("aValue");
{'fraction_non_alphanumeric': 0.09438288116163546, 'fraction_numerical': 0.010317157050057318, 'mean_word_length': 3.6908602150537635, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2015874', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1392, 'n_words': 370}