<commit_before>package org.innovateuk.ifs.competitionsetup.form;

import org.innovateuk.ifs.competition.resource.CompetitionResource;
import org.innovateuk.ifs.competition.resource.MilestoneType;
import org.junit.Test;

import java.time.ZonedDateTime;
import java.time.ZonedDateTime;

import static org.innovateuk.ifs.competition.builder.CompetitionResourceBuilder.newCompetitionResource;
import static org.junit.Assert.*;

public class MilestoneRowFormTest {

    @Test
    public void testGetMilestoneViewModel() throws Exception {
        ZonedDateTime localDateTime = ZonedDateTime.now().plusDays(3);
        String dayOfWeek = localDateTime.getDayOfWeek().name().substring(0, 1)
                + localDateTime.getDayOfWeek().name().substring(1, 3).toLowerCase();
        MilestoneRowForm milestoneRowForm = new MilestoneRowForm(MilestoneType.OPEN_DATE, localDateTime);

        assertEquals(MilestoneType.OPEN_DATE.name(), milestoneRowForm.getMilestoneNameType());
        assertEquals(MilestoneType.OPEN_DATE, milestoneRowForm.getMilestoneType());
        assertEquals(dayOfWeek, milestoneRowForm.getDayOfWeek());
        assertEquals(Integer.valueOf(localDateTime.getDayOfMonth()), milestoneRowForm.getDay());
        assertEquals(Integer.valueOf(localDateTime.getMonthValue()), milestoneRowForm.getMonth());
        assertEquals(Integer.valueOf(localDateTime.getYear()), milestoneRowForm.getYear());
    }

    @Test
    public void testEditableForCompetition() {
        CompetitionResource nonIfsCompetition = newCompetitionResource().withNonIfs(true).build();
        CompetitionResource notSetupCompetition = newCompetitionResource().withSetupComplete(false).build();
        CompetitionResource setupCompetition = newCompetitionResource().withSetupComplete(true).withStartDate(ZonedDateTime.now().minusDays(1)).build();


        MilestoneRowForm pastRow = new MilestoneRowForm(MilestoneType.OPEN_DATE, ZonedDateTime.now().minusDays(1));
        MilestoneRowForm futureRow = new MilestoneRowForm(MilestoneType.OPEN_DATE, ZonedDateTime.now().plusDays(1));

        //Non IFS competitions always dates editable
        assertTrue(pastRow.editableForCompetition(nonIfsCompetition));
        assertTrue(futureRow.editableForCompetition(nonIfsCompetition));

        //Competition in setup always dates editable
        assertTrue(pastRow.editableForCompetition(notSetupCompetition));
        assertTrue(futureRow.editableForCompetition(notSetupCompetition));

        //Open competition can only edit past dates
        assertFalse(pastRow.editableForCompetition(setupCompetition));
        assertTrue(futureRow.editableForCompetition(setupCompetition));
    }

}<commit_msg>Fixing broken build dev<commit_after>package org.innovateuk.ifs.competitionsetup.form;

import org.innovateuk.ifs.competition.resource.MilestoneType;
import org.junit.Test;

import java.time.ZonedDateTime;

import static org.junit.Assert.assertEquals;

public class MilestoneRowFormTest {

    @Test
    public void testGetMilestoneViewModel() throws Exception {
        ZonedDateTime localDateTime = ZonedDateTime.now().plusDays(3);
        String dayOfWeek = localDateTime.getDayOfWeek().name().substring(0, 1)
                + localDateTime.getDayOfWeek().name().substring(1, 3).toLowerCase();
        MilestoneRowForm milestoneRowForm = new MilestoneRowForm(MilestoneType.OPEN_DATE, localDateTime);

        assertEquals(MilestoneType.OPEN_DATE.name(), milestoneRowForm.getMilestoneNameType());
        assertEquals(MilestoneType.OPEN_DATE, milestoneRowForm.getMilestoneType());
        assertEquals(dayOfWeek, milestoneRowForm.getDayOfWeek());
        assertEquals(Integer.valueOf(localDateTime.getDayOfMonth()), milestoneRowForm.getDay());
        assertEquals(Integer.valueOf(localDateTime.getMonthValue()), milestoneRowForm.getMonth());
        assertEquals(Integer.valueOf(localDateTime.getYear()), milestoneRowForm.getYear());
    }
}
{'fraction_non_alphanumeric': 0.10152671755725191, 'fraction_numerical': 0.0033078880407124683, 'mean_word_length': 5.171114599686028, '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': '4050975', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1033, 'n_words': 150}