generator.server.javatool.memoizers.test.MemoizersTest.mustache Maven / Gradle / Ivy
package {{packageName}}.shared.memoizer.domain;
import static org.assertj.core.api.Assertions.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;
@UnitTest
class MemoizersTest {
@Test
void shouldGetFunctionResult() {
Function memoizer = Memoizers.of(d -> d * d);
assertThat(memoizer.apply(2D)).isEqualTo(4D);
}
@Test
void shouldMemoizeFunctionResult() {
AtomicInteger result = new AtomicInteger();
Function