Line | |
---|
1 | package com.ether; |
---|
2 | |
---|
3 | import org.junit.Assert; |
---|
4 | import org.junit.Test; |
---|
5 | |
---|
6 | import java.text.DateFormat; |
---|
7 | import java.text.SimpleDateFormat; |
---|
8 | import java.util.ArrayList; |
---|
9 | import java.util.Calendar; |
---|
10 | import java.util.Date; |
---|
11 | import java.util.HashSet; |
---|
12 | import java.util.List; |
---|
13 | import java.util.Set; |
---|
14 | |
---|
15 | /** |
---|
16 | * @author vmipsl |
---|
17 | * @date 2011 |
---|
18 | */ |
---|
19 | public class OtherTest |
---|
20 | { |
---|
21 | @Test |
---|
22 | public void testCreateXML() |
---|
23 | throws Exception |
---|
24 | { |
---|
25 | |
---|
26 | final DateFormat shortDateFormat = new SimpleDateFormat( "MMyyyy" ); |
---|
27 | final DateFormat completDateFormat = new SimpleDateFormat( "dd-MM-yyyy" ); |
---|
28 | final Date firstMois = shortDateFormat.parse( "102008" ); |
---|
29 | final String firstMoisString = completDateFormat.format( firstMois ); |
---|
30 | Assert.assertEquals( firstMoisString, "01-10-2008" ); |
---|
31 | |
---|
32 | final Calendar calendar = Calendar.getInstance(); |
---|
33 | calendar.setTime( firstMois ); |
---|
34 | calendar.add( Calendar.MONTH, 1 ); |
---|
35 | final Date secondMois = calendar.getTime(); |
---|
36 | final String secondMoisString = completDateFormat.format( secondMois ); |
---|
37 | Assert.assertEquals( secondMoisString, "01-11-2008" ); |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.