Skip to content

Commit

Permalink
added lazyOf methods test
Browse files Browse the repository at this point in the history
  • Loading branch information
evpl committed Jan 21, 2025
1 parent 8de17d4 commit bb45c2d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/java/com/plugatar/jkscope/LazyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -172,4 +173,17 @@ void lazyMethodWithThreadSafetyModeAndSupplierUnsafeMode() {
).isSameAs(result);
verify(initializer, times(1)).get();
}

@Test
void lazyOfMethod() {
final Object result = new Object();
final Lazy<Object> lazy = lazyOf(result);

assertThat(
lazy.get()
).isSameAs(result);
assertThat(
lazy.get()
).isSameAs(result);
}
}

0 comments on commit bb45c2d

Please sign in to comment.