Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.selgp.moladek.core.utils;
 
Contains helper methods for generating test data.

Author(s):
guillem.hernandez
public final class DataGeneratorUtil {
  private static final String TIMESTAMP_FORMAT = "MM.dd_HH.mm.ss";
  private static final String DATE_AND_TIME_FORMAT = "EEE, d MMM yyyy HH:mm:ss";
  private DataGeneratorUtil() {
    // Util class
  }
  public static String getTimestamp() {
    Calendar cal = Calendar.getInstance();
    return date.format(cal.getTime());
  }
  public static String getUniqueId() {
    final int length = 8;
    return (String) String.valueOf(java.util.UUID.randomUUID()).subSequence(0, length);
  }
  public static String getDayAndTime() {
    Calendar cal = Calendar.getInstance();
    return date.format(cal.getTime());
  }
  public static int getDayOfTheYear() {
    Calendar cal = Calendar.getInstance();
    return cal.get(.);
  }
  public static int getYear() {
    Calendar cal = Calendar.getInstance();
    return cal.get(.);
  }
New to GrepCode? Check out our FAQ X