File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
main/java/us/fatehi/creditcardnumber
test/java/us/fatehi/test/creditcardnumber Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,13 @@ public ExpirationDate() {
32
32
}
33
33
34
34
/**
35
- * Expiration date from date.
35
+ * Expiration date from date. (Deprecated, since it uses a deprecated API. Use other constructors
36
+ * instead.)
36
37
*
37
38
* @param date Date
39
+ * @deprecated Use {@link ExpirationDate#ExpirationDate(int, int)}
38
40
*/
41
+ @ Deprecated
39
42
public ExpirationDate (final Date date ) {
40
43
super (null );
41
44
if (date != null ) {
Original file line number Diff line number Diff line change 11
11
import static org .hamcrest .MatcherAssert .assertThat ;
12
12
import static org .hamcrest .Matchers .nullValue ;
13
13
14
+ import java .time .LocalDate ;
14
15
import java .time .YearMonth ;
16
+ import java .time .ZoneId ;
15
17
import java .util .Date ;
16
18
17
19
import org .junit .jupiter .api .Test ;
@@ -105,7 +107,8 @@ public void expirationDate1() {
105
107
106
108
@ Test
107
109
public void expirationDate2 () {
108
- final Date date = new Date (112 , 11 , 1 );
110
+ final LocalDate localDate = LocalDate .of (2012 , 12 , 12 );
111
+ final Date date = Date .from (localDate .atStartOfDay (ZoneId .systemDefault ()).toInstant ());
109
112
final ExpirationDate expirationDate = new ExpirationDate (date );
110
113
assertThat (expirationDate .hasRawData (), is (false ));
111
114
assertThat (expirationDate .exceedsMaximumLength (), is (false ));
You can’t perform that action at this time.
0 commit comments