Package de.timefinder.algo.constraint

Source Code of de.timefinder.algo.constraint.RasterConstraintTest

/*
*  Copyright 2009 Peter Karich, peat_hal 'at' users 'dot' sourceforge 'dot' net.
*
*  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.
*  under the License.
*/
package de.timefinder.algo.constraint;

import de.timefinder.algo.util.TimeFinder2Tester;
import de.timefinder.data.Event;
import de.timefinder.data.set.BitRaster;
import de.timefinder.data.set.WeekRaster;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;

/**
*
* @author Peter Karich, peat_hal 'at' users 'dot' sourceforge 'dot' net
*/
public class RasterConstraintTest extends TimeFinder2Tester {

    public RasterConstraintTest() {
    }

    @Before
    @Override
    public void setUp() {
        super.setUp();
    }

    @Test
    public void testGetViolations() {
        List list = mock(List.class);
        list.add("one");
        assertEquals(null, list.get(0));

        when(list.get(0)).thenReturn("two");
        assertEquals("two", list.get(0));

        BitRaster mockedRaster = mock(BitRaster.class);
        WeekRaster weekRaster = mock(WeekRaster.class);
        Event ev = newEvent(0, 2);

        when(mockedRaster.isAssigned(0)).thenReturn(true);
        when(mockedRaster.isAssigned(1)).thenReturn(true);
       
        when(weekRaster.getForbidden()).thenReturn(mockedRaster);

        RasterConstraint constr = new RasterConstraint(weekRaster);
//        assertEquals(2, constr.getViolations(new Assignment(ev)));
    }
}
TOP

Related Classes of de.timefinder.algo.constraint.RasterConstraintTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.