public static String getFormattedDate() {
        DateFormat dateFormat = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        return dateFormat.format(date);
    }
@Test
    public void testFormatter() {

        String dateRegex1 = "^((19|20)\\d\\d)-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01]) ([2][0-3]|[0-1][0-9]|[1-9]):[0-5][0-9]:([0-5][0-9]|[6][0])$";
        String dateString = Formatter.getFormattedDate();
        assertTrue(Pattern
            .matches(dateRegex1, dateString));

    }