package fr.oltruong.teamag.utils;

import static org.assertj.core.api.Assertions.assertThat;


import org.joda.time.DateTime;
import org.joda.time.DateTimeConstants;
import org.junit.Test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.util.List;

public class CalendarUtilsTest {

    @Test
    public void testGetWorkingDays() {

        DateTime january= DateTime.now().withMonthOfYear(1);
        List <DateTime> workingDays = CalendarUtils.getWorkingDays(january);
        assertThat(workingDays).isNotNull();
        for (DateTime day:workingDays){
            assertThat(day.getDayOfWeek()).isNotEqualTo(DateTimeConstants.SUNDAY).isNotEqualTo(DateTimeConstants.SATURDAY);
            assertThat(day.getDayOfMonth()).isNotEqualTo(1);
        }
    }


        @Test
    public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
            Constructor<CalendarUtils> constructor = CalendarUtils.class.getDeclaredConstructor();
            assertThat(Modifier.isPrivate(constructor.getModifiers())).isTrue();
            constructor.setAccessible(true);
            constructor.newInstance();
    }

}

@@ -91,104 +91,8 @@
 t;%0A%0A
-%0Aimport org.joda.time.DateTime;%0Aimport org.joda.time.DateTimeConstants;%0Aimport org.junit.Test;%0A%0A
 impo
@@ -236,16 +236,152 @@
 .List;%0A%0A
+import org.joda.time.DateTime;%0Aimport org.joda.time.DateTimeConstants;%0Aimport org.junit.Test;%0A%0Aimport com.google.common.collect.Lists;%0A%0A
 public c
@@ -450,16 +450,23 @@
 kingDays
+January
 () %7B%0A%0A  
@@ -475,24 +475,484 @@
     
-DateTime january
+testWorkingDays(1, Lists.newArrayList(1));%0A        testWorkingDays(2, Lists.newArrayList(0));%0A        testWorkingDays(4, Lists.newArrayList(1));%0A        testWorkingDays(5, Lists.newArrayList(1, 8, 9, 20));%0A        testWorkingDays(8, Lists.newArrayList(15));%0A        testWorkingDays(11, Lists.newArrayList(1, 11));%0A        testWorkingDays(12, Lists.newArrayList(25));%0A%0A    %7D%0A%0A    private void testWorkingDays(int monthNumber, Iterable%3CInteger%3E values) %7B%0A        DateTime month 
 = Da
@@ -980,17 +980,27 @@
 hOfYear(
-1
+monthNumber
 );%0A     
@@ -1006,17 +1006,16 @@
     List
- 
 %3CDateTim
@@ -1064,15 +1064,13 @@
 ays(
-january
+month
 );%0A 
@@ -1142,9 +1142,11 @@
  day
-:
+ : 
 work
@@ -1153,16 +1153,17 @@
 ingDays)
+ 
 %7B%0A      
@@ -1295,32 +1295,48 @@
      assertThat(
+Integer.valueOf(
 day.getDayOfMont
@@ -1343,26 +1343,28 @@
 h())
+)
 .isNot
-EqualTo(1
+In(values
 );%0A
+%0A
     
@@ -1376,21 +1376,16 @@
 %0A    %7D%0A%0A
-%0A    
     @Tes
@@ -1543,20 +1543,16 @@
         
-    
 Construc
@@ -1626,28 +1626,24 @@
 structor();%0A
-    
         asse
@@ -1707,36 +1707,32 @@
 True();%0A        
-    
 constructor.setA
@@ -1748,20 +1748,16 @@
 (true);%0A
-    
         

Add UT