test/java/time/test/java/time/format/AbstractTestPrinterParser.java
Print this page
@@ -57,20 +57,22 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package test.java.time.format;
-import java.time.format.*;
-
-import java.util.Locale;
-
import java.time.DateTimeException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatSymbols;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.SignStyle;
+import java.time.format.TextStyle;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
+import java.util.Locale;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -84,11 +86,11 @@
protected TemporalAccessor dta;
protected Locale locale;
protected DateTimeFormatSymbols symbols;
- @BeforeMethod(groups={"tck"})
+ @BeforeMethod
public void setUp() {
buf = new StringBuilder();
builder = new DateTimeFormatterBuilder();
dta = ZonedDateTime.of(LocalDateTime.of(2011, 6, 30, 12, 30, 40, 0), ZoneId.of("Europe/Paris"));
locale = Locale.ENGLISH;
@@ -121,10 +123,14 @@
protected DateTimeFormatter getFormatter(String s) {
return builder.appendLiteral(s).toFormatter(locale).withSymbols(symbols);
}
+ protected DateTimeFormatter getFormatter(TemporalField field) {
+ return builder.appendText(field).toFormatter(locale).withSymbols(symbols);
+ }
+
protected DateTimeFormatter getFormatter(TemporalField field, TextStyle style) {
return builder.appendText(field, style).toFormatter(locale).withSymbols(symbols);
}
protected DateTimeFormatter getFormatter(TemporalField field, int minWidth, int maxWidth, SignStyle signStyle) {
@@ -133,10 +139,14 @@
protected DateTimeFormatter getFormatter(String pattern, String noOffsetText) {
return builder.appendOffset(pattern, noOffsetText).toFormatter(locale).withSymbols(symbols);
}
+ protected DateTimeFormatter getPatternFormatter(String pattern) {
+ return builder.appendPattern(pattern).toFormatter(locale).withSymbols(symbols);
+ }
+
protected static final TemporalAccessor EMPTY_DTA = new TemporalAccessor() {
public boolean isSupported(TemporalField field) {
return true;
}
@Override