// Copyright 2015 Google Inc. All Rights Reserved.

package org.robolectric.shadows;

import android.icu.text.DateFormat;
import android.icu.text.SimpleDateFormat;
import android.icu.util.TimeZone;
import android.icu.util.ULocale;
import android.os.Build;
import android.text.format.DateUtils;
import libcore.icu.DateIntervalFormat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.TestRunners;
import org.robolectric.annotation.Config;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;

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

@RunWith(TestRunners.MultiApiWithDefaults.class)
@Config(sdk = {
    Build.VERSION_CODES.M })
public class ShadowDateIntervalFormatTest {

    @Test
    public void testDateInterval_FormatDateRange() throws ParseException {
      Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.YEAR, 2013);
      calendar.set(Calendar.MONTH, Calendar.JANUARY);
      calendar.set(Calendar.DAY_OF_MONTH, 20);

      long timeInMillis = calendar.getTimeInMillis();
      String actual = DateIntervalFormat.formatDateRange(ULocale.getDefault(), TimeZone.getDefault(), timeInMillis, timeInMillis, DateUtils.FORMAT_NUMERIC_DATE);

      DateFormat format = new SimpleDateFormat("MM/dd/yyyy", ULocale.getDefault());
      Date date = format.parse(actual);

      assertThat(date).isNotNull();
    }

}

@@ -746,19 +746,16 @@
 t %7B%0A
-%0A  
   @Test%0A
     
@@ -750,18 +750,16 @@
   @Test%0A
-  
   public
@@ -823,18 +823,16 @@
 ption %7B%0A
-  
     Cale
@@ -871,26 +871,24 @@
 ance();%0A    
-  
 calendar.set
@@ -910,18 +910,16 @@
  2013);%0A
-  
     cale
@@ -962,18 +962,16 @@
 NUARY);%0A
-  
     cale
@@ -1012,18 +1012,16 @@
 );%0A%0A    
-  
 long tim
@@ -1060,18 +1060,16 @@
 llis();%0A
-  
     Stri
@@ -1221,26 +1221,24 @@
 DATE);%0A%0A    
-  
 DateFormat f
@@ -1307,18 +1307,16 @@
 ));%0A    
- 
- 
 Date dat
@@ -1346,18 +1346,16 @@
 );%0A%0A    
-  
 assertTh
@@ -1382,11 +1382,8 @@
 ;%0A  
-  %7D%0A
+%7D
 %0A%7D%0A

fix indentation...whoops