Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 Terracotta, Inc. Copyright 2011 Oracle, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package javax.cache;
 
 import org.junit.Rule;
 import org.junit.Test;
 
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertTrue;

Unit tests for CacheBuilder

Author(s):
Yannis Cosmadopoulos
Since:
1.0
 
 public class CacheConfigurationTest {
    
Rule used to exclude tests
 
     @Rule
     public ExcludeListExcluder rule = new ExcludeListExcluder(this.getClass());
 
     @Test
     public void checkDefaults() {
         assertFalse(config.isReadThrough());
         assertFalse(config.isWriteThrough());
         assertFalse(config.isStatisticsEnabled());
         assertTrue(config.isStoreByValue());
     }
 
     @Test
     public void notSame() {
         CacheManager cacheManager = ..getCacheManager();
         assertNotSame(cacheManager.createCacheConfiguration(), cacheManager.createCacheConfiguration());
     }

    
 
     @Test
     public void equals() {
         CacheManager cacheManager = ..getCacheManager();
         CacheConfiguration cacheConfiguration1 = cacheManager.createCacheConfiguration();
         CacheConfiguration cacheConfiguration2 = cacheManager.createCacheConfiguration();
         //Uses ==
         assertFalse(cacheConfiguration1.equals(cacheConfiguration2));
     }
 
     @Test
     public void equalsNotEquals() {
         CacheManager cacheManager = ..getCacheManager();
         CacheConfiguration config1 = cacheManager.createCacheConfiguration();
         config1.setReadThrough(!config1.isReadThrough());
         CacheConfiguration config2 = cacheManager.createCacheConfiguration();
         assertFalse(config1.equals(config2));
     }
 
     @Test
     public void setReadThrough() {
         boolean flag = config.isReadThrough();
         config.setReadThrough(!flag);
         assertEquals(!flagconfig.isReadThrough());
     }
 
     @Test
     public void setStoreByValue() {
         boolean flag = config.isStoreByValue();
         config.setStoreByValue(!flag);
         assertEquals(!flagconfig.isStoreByValue());
     }
 
     @Test
     public void setWriteThrough() {
         boolean flag = config.isWriteThrough();
        config.setWriteThrough(!flag);
        assertEquals(!flagconfig.isWriteThrough());
    }
    // ---------- utilities ----------
New to GrepCode? Check out our FAQ X