Cucumber-java-Startdate shouldn't be todays date in Java script

Viewed 17

I am new to this code. While running automation script, the date is automatically picked todays date. actually the date starts from 01/01/2022.

How to change this code?

public void validateStartDateDefaultValueNew() throws Exception{

Date date = Calendar.getInstance().getTime();

DateFormat date formatter = new SimpleDateFormat( pattern: "dd/MM/yyyy");

String today = dateformatter.format(date);

System.out.println("today is "+today);

System.out.println("formatted today is "+date formatter.parse(today))

String [] actual1 = searchStartDateInput.getAttribute("value").split(regor " ");

String actual actuall[0]; =

System.out.println("today actual app is [+actual);

Assert.assertEquals(today, actual);

1 Answers

In your code, you mentioned - 'Date date = Calendar.getInstance().getTime();'. This line of code takes today's date and current time.

If you want the start date to be '01/01/2022', then hard-code it in your code.

Related