@@ -0,0 +1,2020 @@
+/*%0A * RESTHeart - the Web API for MongoDB%0A * Copyright (C) SoftInstigate Srl%0A * %0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A * %0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A * %0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage org.restheart.cache.impl;%0A%0Aimport java.util.Optional;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0Aimport org.restheart.cache.Cache;%0A%0A/**%0A *%0A * @author mturatti%0A */%0Apublic class GuavaCacheTest %7B%0A%0A    public GuavaCacheTest() %7B%0A    %7D%0A%0A    @Test%0A    public void testGet() %7B%0A        System.out.println(%22get%22);%0A        Object key = %22A%22;%0A        GuavaCache instance = new GuavaCache(100, Cache.EXPIRE_POLICY.AFTER_WRITE, 10000);%0A        instance.put(key, 1);%0A        Optional%3CInteger%3E result = instance.get(key);%0A        assertTrue(result.isPresent());%0A        assertEquals(Integer.valueOf(1), result.get());%0A    %7D%0A%0A    @Test%0A    public void getNonExistent() %7B%0A        System.out.println(%22getNonExistent%22);%0A        GuavaCache instance = new GuavaCache(100, Cache.EXPIRE_POLICY.AFTER_WRITE, 10000);%0A        Optional%3CInteger%3E result = instance.get(%22A%22);%0A        assertNull(result);%0A    %7D%0A%0A    @Test%0A    public void testPutNull() %7B%0A        System.out.println(%22putNull%22);%0A        String key = %22B%22;%0A        Object value = null;%0A        GuavaCache instance = new GuavaCache(100, Cache.EXPIRE_POLICY.AFTER_WRITE, 10000);%0A        instance.put(key, value);%0A        Optional%3CInteger%3E result = instance.get(key);%0A        assertFalse(result.isPresent());%0A    %7D%0A%0A%7D%0A

Add GuavaCacheTest