1818import static com .google .gitiles .ConfigUtil .getDuration ;
1919import static org .junit .Assert .fail ;
2020
21+ import java .time .Duration ;
2122import org .eclipse .jgit .lib .Config ;
22- import org .joda .time .Duration ;
2323import org .junit .Test ;
2424import org .junit .runner .RunWith ;
2525import org .junit .runners .JUnit4 ;
2929public class ConfigUtilTest {
3030 @ Test
3131 public void getDurationReturnsDuration () throws Exception {
32- Duration def = Duration .standardSeconds (2 );
32+ Duration def = Duration .ofSeconds (2 );
3333 Config config = new Config ();
3434 Duration t ;
3535
3636 config .setString ("core" , "dht" , "timeout" , "500 ms" );
3737 t = getDuration (config , "core" , "dht" , "timeout" , def );
38- assertThat (t .getMillis ()).isEqualTo (500 );
38+ assertThat (t .toMillis ()).isEqualTo (500 );
3939
4040 config .setString ("core" , "dht" , "timeout" , "5.2 sec" );
4141 try {
@@ -47,25 +47,25 @@ public void getDurationReturnsDuration() throws Exception {
4747
4848 config .setString ("core" , "dht" , "timeout" , "1 min" );
4949 t = getDuration (config , "core" , "dht" , "timeout" , def );
50- assertThat (t .getMillis ()).isEqualTo (60000 );
50+ assertThat (t .toMillis ()).isEqualTo (60000 );
5151 }
5252
5353 @ Test
5454 public void getDurationCanReturnDefault () throws Exception {
55- Duration def = Duration .standardSeconds (1 );
55+ Duration def = Duration .ofSeconds (1 );
5656 Config config = new Config ();
5757 Duration t ;
5858
5959 t = getDuration (config , "core" , null , "blank" , def );
60- assertThat (t .getMillis ()).isEqualTo (1000 );
60+ assertThat (t .toMillis ()).isEqualTo (1000 );
6161
6262 config .setString ("core" , null , "blank" , "" );
6363 t = getDuration (config , "core" , null , "blank" , def );
64- assertThat (t .getMillis ()).isEqualTo (1000 );
64+ assertThat (t .toMillis ()).isEqualTo (1000 );
6565
6666 config .setString ("core" , null , "blank" , " " );
6767 t = getDuration (config , "core" , null , "blank" , def );
68- assertThat (t .getMillis ()).isEqualTo (1000 );
68+ assertThat (t .toMillis ()).isEqualTo (1000 );
6969 }
7070
7171 @ Test
0 commit comments