All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fest.assertions.error.OptionalShouldBePresentWithValue Maven / Gradle / Ivy

The newest version!
package org.fest.assertions.error;

import com.google.common.base.Optional;

/**
 * 
 * Creates an error message indicating that an Optional should contain an expected value
 * 
 * @author Kornel Kiełczewski
 * @author Joel Costigliola
 */
public final class OptionalShouldBePresentWithValue extends BasicErrorMessageFactory {

  public static  ErrorMessageFactory shouldBePresentWithValue(final Optional actual, final Object value) {
    return new OptionalShouldBePresentWithValue("\nExpecting Optional to contain value \n<%s>\n but contained \n<%s>",
        value, actual.get());
  }

  public static  ErrorMessageFactory shouldBePresentWithValue(final Object value) {
    return new OptionalShouldBePresentWithValue(
        "Expecting Optional to contain <%s> but contained nothing (absent Optional)", value);
  }

  private OptionalShouldBePresentWithValue(final String format, final Object... arguments) {
    super(format, arguments);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy