Examples of MemoizeConfig


Examples of org.jhighfun.util.memoize.MemoizeConfig

                for (String string : args) {
                    builder.append(string);
                }
                return builder.toString();
            }
        }, new MemoizeConfig(100, TimeUnit.MILLISECONDS, 10));

        assertEquals(spyInjection.size(), 0);
        assertEquals(memoizedFunction.apply(CollectionUtil.List("I", "am", "the", "Almighty")), "IamtheAlmighty");
        assertEquals(spyInjection.size(), 1);
View Full Code Here

Examples of org.jhighfun.util.memoize.MemoizeConfig

        Function<String, String> mockFunction = mock(Function.class);

        final int cacheSize = 100;

        Function<String, String> memoizedFunction = FunctionUtil.memoize(mockFunction, new MemoizeConfig(100, TimeUnit.MILLISECONDS, cacheSize));

        //set expectation
        for (int i = 1; i <= cacheSize; i++) {
            when(mockFunction.apply(String.valueOf(i))).thenReturn(String.valueOf(i));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.