// 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.junit.Assert.assertNotNull;

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

    @Test
    public void testDateInterval_FormatDateRange() {
        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 = null;
        try {
            date = format.parse(actual);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        assertNotNull(date);

    }

}

@@ -567,34 +567,46 @@
 org.
-junit
+assertj.core.api
 .Assert
+ions
 .assert
-NotNull
+That
 ;%0A%0A@
@@ -804,20 +804,40 @@
 Range() 
+throws ParseException 
 %7B%0A
-  
       Ca
@@ -876,34 +876,32 @@
 stance();%0A      
-  
 calendar.set(Cal
@@ -917,34 +917,32 @@
 R, 2013);%0A      
- 
- 
 calendar.set(Cal
@@ -975,26 +975,24 @@
 ARY);%0A      
-  
 calendar.set
@@ -1017,26 +1017,24 @@
 ONTH, 20);%0A%0A
-  
       long t
@@ -1081,18 +1081,16 @@
 ;%0A      
-  
 String a
@@ -1240,26 +1240,24 @@
 TE);%0A%0A      
-  
 DateFormat f
@@ -1324,26 +1324,24 @@
 t());%0A      
-  
 Date date = 
@@ -1343,47 +1343,8 @@
 te =
- null;%0A        try %7B%0A            date =
  for
@@ -1366,110 +1366,42 @@
 l);%0A
-  
+%0A
       
-%7D catch (ParseException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        assert
+assertThat(date).is
 NotNull(
 date
@@ -1400,16 +1400,11 @@
 ull(
-date
 );%0A
-%0A
     

Fix indentation, uses assertThat, and made the test itself throw exception