### Question:
ShippingInfoWidget extends LinearLayout { public void setOptionalFields(@Nullable List<String> optionalAddressFields) { if (optionalAddressFields != null) { mOptionalShippingInfoFields = optionalAddressFields; } else { mOptionalShippingInfoFields = new ArrayList<>(); } renderLabels(); renderCountrySpecificLabels(mCountryAutoCompleteTextView.getSelectedCountryCode()); } ShippingInfoWidget(Context context);  ShippingInfoWidget(Context context, AttributeSet attrs);  ShippingInfoWidget(Context context, AttributeSet attrs, int defStyleAttr); void setOptionalFields(@Nullable List<String> optionalAddressFields); void setHiddenFields(@Nullable List<String> hiddenAddressFields); ShippingInformation getShippingInformation(); void populateShippingInfo(@Nullable ShippingInformation shippingInformation); boolean validateAllFields(); static final String ADDRESS_LINE_ONE_FIELD; static final String ADDRESS_LINE_TWO_FIELD; static final String CITY_FIELD; static final String POSTAL_CODE_FIELD; static final String STATE_FIELD; static final String PHONE_FIELD; }### Answer:
@Test public void shippingInfoWidget_whenFieldsOptional_markedAsOptional(){ assertEquals(mPostalCodeTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_zip_code)); assertEquals(mNameTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_name)); List<String> optionalFields = new ArrayList<>(); optionalFields.add(ShippingInfoWidget.POSTAL_CODE_FIELD); mShippingInfoWidget.setOptionalFields(optionalFields); assertEquals(mPostalCodeTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_zip_code_optional)); assertEquals(mNameTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_name)); mCountryAutoCompleteTextView.updateUIForCountryEntered(Locale.CANADA.getDisplayCountry()); assertEquals(mStateTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_province)); optionalFields.add(ShippingInfoWidget.STATE_FIELD); mShippingInfoWidget.setOptionalFields(optionalFields); assertEquals(mStateTextInputLayout.getHint().toString(), mShippingInfoWidget.getResources().getString(R.string.address_label_province_optional)); }