com.fitbur.assertj.api.DateAssert Maven / Gradle / Ivy
The newest version!
/**
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2012-2016 the original author or authors.
*/
package com.fitbur.assertj.api;
import java.text.DateFormat;
import java.util.Date;
/**
* Assertions for {@link Date}s.
*
* To create a new instance of this class invoke {@link Assertions#assertThat(Date)}
.
*
* Note that assertions with date parameter comes with two flavor, one is obviously a {@link Date} and the other is a String
* representing a Date.
* For the latter, the default format follows ISO 8901 : "yyyy-MM-dd", user can override it with a custom format by calling
* {@link #withDateFormat(DateFormat)}.
* The user custom format will then be used for all next Date assertions (i.e not limited to the current assertion) in the test
* suite.
* To turn back to default format, simply call {@link #withDefaultDateFormatsOnly()}.
*
* @author Tomasz Nurkiewicz (thanks for giving assertions idea)
* @author Joel Costigliola
* @author Mikhail Mazursky
*/
public class DateAssert extends AbstractDateAssert {
/**
* Creates a new {@link DateAssert}.
* @param actual the target to verify.
*/
protected DateAssert(Date actual) {
super(actual, DateAssert.class);
}
}