/**
  * Constructor. Its parameter comes from all values from {@code valueToTest()}.
  *
  * @param stringValue String the value for {@code testGetAsObjectWithDifferentValues()}.
  * @param getAsObjectExpectedResult the {@code stringValue}'s expected result in test.
  * @param objectValue the value to test in {@code testGetAsStringWithDifferentValues()}.
  * @param getAsStringExpectedResult the {@code objectValue}'s expected result in test.
  */
 public TestConverterLocalDate(
     String stringValue,
     GetAsObjectExpectedResult getAsObjectExpectedResult,
     Object objectValue,
     GetAsStringExpectedResult getAsStringExpectedResult) {
   // Set the parameters for the test
   this.stringValue = stringValue;
   this.getAsObjectExpectedResult = getAsObjectExpectedResult;
   this.objectValue = objectValue;
   this.getAsStringExpectedResult = getAsStringExpectedResult;
   // Initialize the converter and mock the logger
   converter = new ConverterLocalDate();
   converter.setTestLogger(mock(Logger.class));
 }
 /** Test method for {@link ConverterLocalDate#getAsString(FacesContext, UIComponent, Object)}. */
 @Test
 public final void testGetAsStringWithDifferentValues() {
   String result =
       converter.getAsString(mock(FacesContext.class), mock(UIComponent.class), objectValue);
   switch (getAsStringExpectedResult) {
     case FAILURE_NULL: // Expected result is null
     case FAILURE_CLASS_CAST: // Expected result is null
       assertNull(
           "Result should be null with value="
               + (objectValue == null ? objectValue : objectValue.getClass()),
           result);
       break;
     case SUCCESS: // Expected result is a String
       LocalDate dateValue = (LocalDate) objectValue;
       String expectedResult = dateValue.format(ConverterLocalDate.getTestFormatter());
       assertEquals(
           "Conversion should succeed with value="
               + (objectValue == null ? objectValue : objectValue.getClass()),
           expectedResult,
           result);
       break;
   }
 }
 /** Test method for {@link ConverterLocalDate#getAsObject(FacesContext, UIComponent, String)}. */
 @Test
 public final void testGetAsObjectWithDifferentValues() {
   Object result =
       converter.getAsObject(mock(FacesContext.class), mock(UIComponent.class), stringValue);
   switch (getAsObjectExpectedResult) {
     case FAILURE_NULL: // Expected result is null
     case FAILURE_PATTERN: // Expected result is null
       assertNull("Result should be null with value=" + stringValue, result);
       break;
     case SUCCESS: // Expected result is a LocalDate
       assertEquals(
           "Conversion should succeed with value=" + stringValue,
           LocalDate.class,
           result.getClass());
       break;
   }
 }