From bb45c2de458b67d79dc0d9967a64a45a453dc602 Mon Sep 17 00:00:00 2001 From: Evgenii Plugatar Date: Tue, 21 Jan 2025 21:15:17 +0300 Subject: [PATCH] added lazyOf methods test --- src/test/java/com/plugatar/jkscope/LazyTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/com/plugatar/jkscope/LazyTest.java b/src/test/java/com/plugatar/jkscope/LazyTest.java index 0825cd1..33522fd 100644 --- a/src/test/java/com/plugatar/jkscope/LazyTest.java +++ b/src/test/java/com/plugatar/jkscope/LazyTest.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import static com.plugatar.jkscope.JKScope.lazy; +import static com.plugatar.jkscope.JKScope.lazyOf; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.doReturn; @@ -172,4 +173,17 @@ void lazyMethodWithThreadSafetyModeAndSupplierUnsafeMode() { ).isSameAs(result); verify(initializer, times(1)).get(); } + + @Test + void lazyOfMethod() { + final Object result = new Object(); + final Lazy lazy = lazyOf(result); + + assertThat( + lazy.get() + ).isSameAs(result); + assertThat( + lazy.get() + ).isSameAs(result); + } }