dimanche 21 avril 2019

How to write JUnit Testing for methods receives a String and return LocalDate?

I have this method that I want to test it with JUnit. It converts String into LocalDate.

public static LocalDate convertDate(String aDate) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MMM-yyyy");
        LocalDate localDate = LocalDate.parse(aDate, formatter);

        return localDate;
    }

Aucun commentaire:

Enregistrer un commentaire