// Path: src/main/java/com/hadisatrio/optional/function/Consumer.java
// public interface Consumer<T> {
// 
//     void consume(T value);
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Function.java
// public interface Function {
// 
//     void call();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Supplier.java
// public interface Supplier<T> {
// 
//     T get();
// }


import com.hadisatrio.optional.function.Consumer;
import com.hadisatrio.optional.function.Function;
import com.hadisatrio.optional.function.Supplier;
import org.junit.Assert;
import org.junit.Test;

        Assert.assertFalse(Optional.absent().isPresent());
    }

    @Test
    public void get() throws Exception {
        Assert.assertEquals("42", Optional.of("42").get());

        Assert.assertEquals("42", Optional.ofNullable("42").get());

        try {
            Optional.ofNullable(null).get();

            Optional.absent().get();

            Assert.fail("Invoking get() on an absent optional should raise an exception.");
        } catch (IllegalStateException expected) {
            // No-op. This is the expected behaviour.
        }
    }

    @Test
    public void or() throws Exception {
        Assert.assertEquals("42", Optional.ofNullable(null).or("42"));

        Assert.assertEquals("42", Optional.absent().or("42"));
    }

    @Test
    public void orWithSupplier() throws Exception {
// Path: src/main/java/com/hadisatrio/optional/function/Consumer.java
// public interface Consumer<T> {
// 
//     void consume(T value);
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Function.java
// public interface Function {
// 
//     void call();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Supplier.java
// public interface Supplier<T> {
// 
//     T get();
// }


// Path: src/test/java/com/hadisatrio/optional/OptionalTest.java
import com.hadisatrio.optional.function.Consumer;
import com.hadisatrio.optional.function.Function;
import com.hadisatrio.optional.function.Supplier;
import org.junit.Assert;
import org.junit.Test;


        Assert.assertFalse(Optional.absent().isPresent());
    }

    @Test
    public void get() throws Exception {
        Assert.assertEquals("42", Optional.of("42").get());

        Assert.assertEquals("42", Optional.ofNullable("42").get());

        try {
            Optional.ofNullable(null).get();

            Optional.absent().get();

            Assert.fail("Invoking get() on an absent optional should raise an exception.");
        } catch (IllegalStateException expected) {
            // No-op. This is the expected behaviour.
        }
    }

    @Test
    public void or() throws Exception {
        Assert.assertEquals("42", Optional.ofNullable(null).or("42"));

        Assert.assertEquals("42", Optional.absent().or("42"));
    }

    @Test
    public void orWithSupplier() throws Exception {
        final Supplier<String> aStringSupplier = new Supplier<String>() {