<commit_before>package control;

import data.CameraShot;
import data.ScriptingProject;
import gui.CameraShotBlock;
import gui.CameraShotBlockUpdatedEvent;
import gui.RootPane;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

/**
 * @author alex
 */
public class TimelineControllerTest {
    TimelineController timelineController;
    private ScriptingProject project;
    private CameraShot shot;
    private CameraShotBlock shotBlock;

    @Before
    public void initialize() {
        RootPane rootPane = Mockito.mock(RootPane.class);
        timelineController = new TimelineController(rootPane);
        project = timelineController.getScriptingProject();

        shot = new CameraShot("Shot test", "", 1, 2);
        project.getCameraTimelines().get(0).addShot(shot);

        shotBlock = Mockito.mock(CameraShotBlock.class);
        when(shotBlock.getShotId()).thenReturn(shot.getInstance());
    }

    @Test
    public void shotChangedLengthTest() {
        when(shotBlock.getBeginCount()).thenReturn(1.0);
        when(shotBlock.getEndCount()).thenReturn(5.0);
        when(shotBlock.getTimetableNumber()).thenReturn(0);

        timelineController.shotChangedHandler(new CameraShotBlockUpdatedEvent(
                shotBlock, 0
        ));

        assertEquals(shot.getEndCount(), 5.0, 0);
    }

    @Test
    public void shotChangedStartPositionTest() {
        when(shotBlock.getBeginCount()).thenReturn(0.0);
        when(shotBlock.getEndCount()).thenReturn(2.0);
        when(shotBlock.getTimetableNumber()).thenReturn(0);

        timelineController.shotChangedHandler(new CameraShotBlockUpdatedEvent(
                shotBlock, 0
        ));

        assertEquals(shot.getStartCount(), 0.0, 0);
    }

    @Test
    public void shotChangedTimelinesTest() {
        when(shotBlock.getBeginCount()).thenReturn(1.0);
        when(shotBlock.getEndCount()).thenReturn(2.0);
        when(shotBlock.getTimetableNumber()).thenReturn(1);

        timelineController.shotChangedHandler(new CameraShotBlockUpdatedEvent(
                shotBlock, 0
        ));

        // Verify movement between timelines
        assertEquals(project.getCameraTimelines().get(0).getShots().size(), 0);
        assertEquals(project.getCameraTimelines().get(1).getShots().size(), 1);
    }
}<commit_msg>Fix indentation TimelineControllerTest<commit_after>package control;

import data.CameraShot;
import data.ScriptingProject;
import gui.CameraShotBlock;
import gui.CameraShotBlockUpdatedEvent;
import gui.RootPane;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

/**
 * @author alex
 */
public class TimelineControllerTest {
    TimelineController timelineController;
    private ScriptingProject project;
    private CameraShot shot;
    private CameraShotBlock shotBlock;

    @Before
    public void initialize() {
        RootPane rootPane = Mockito.mock(RootPane.class);
        timelineController = new TimelineController(rootPane);
        project = timelineController.getScriptingProject();

        shot = new CameraShot("Shot test", "", 1, 2);
        project.getCameraTimelines().get(0).addShot(shot);

        shotBlock = Mockito.mock(CameraShotBlock.class);
        when(shotBlock.getShotId()).thenReturn(shot.getInstance());
    }

    @Test
    public void shotChangedLengthTest() {
        when(shotBlock.getBeginCount()).thenReturn(1.0);
        when(shotBlock.getEndCount()).thenReturn(5.0);
        when(shotBlock.getTimetableNumber()).thenReturn(0);

        timelineController.shotChangedHandler(
                new CameraShotBlockUpdatedEvent(shotBlock, 0)
        );

        assertEquals(shot.getEndCount(), 5.0, 0);
    }

    @Test
    public void shotChangedStartPositionTest() {
        when(shotBlock.getBeginCount()).thenReturn(0.0);
        when(shotBlock.getEndCount()).thenReturn(2.0);
        when(shotBlock.getTimetableNumber()).thenReturn(0);

        timelineController.shotChangedHandler(
                new CameraShotBlockUpdatedEvent(shotBlock, 0)
        );

        assertEquals(shot.getStartCount(), 0.0, 0);
    }

    @Test
    public void shotChangedTimelinesTest() {
        when(shotBlock.getBeginCount()).thenReturn(1.0);
        when(shotBlock.getEndCount()).thenReturn(2.0);
        when(shotBlock.getTimetableNumber()).thenReturn(1);

        timelineController.shotChangedHandler(
                new CameraShotBlockUpdatedEvent(shotBlock, 0)
        );

        // Verify movement between timelines
        assertEquals(project.getCameraTimelines().get(0).getShots().size(), 0);
        assertEquals(project.getCameraTimelines().get(1).getShots().size(), 1);
    }
}
{'fraction_non_alphanumeric': 0.11475748194014448, 'fraction_numerical': 0.012796697626418989, 'mean_word_length': 3.4175022789425706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3132188', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1356, 'n_words': 220}