// Path: src/test/java/org/ehcache/sizeof/filteredtest/AnnotationFilteredPackage.java
// public class AnnotationFilteredPackage {
// 
//     private final byte[] bigArray = new byte[16 * 1024];
// }
// 
// Path: src/test/java/org/ehcache/sizeof/filteredtest/custom/CustomAnnotationFilteredPackage.java
// public class CustomAnnotationFilteredPackage {
// }


import org.ehcache.sizeof.annotations.IgnoreSizeOf;
import org.ehcache.sizeof.filteredtest.AnnotationFilteredPackage;
import org.ehcache.sizeof.filteredtest.custom.CustomAnnotationFilteredPackage;
import org.ehcache.sizeof.filters.AnnotationSizeOfFilter;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
/**
 * Copyright Terracotta, 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 org.ehcache.sizeof;



/**
 * @author Alex Snaps
 */
public class FilteredSizeOfTest extends AbstractSizeOfTest {
    private static long deepSizeOf(SizeOf sizeOf, Object... obj) {
        return sizeOf.deepSizeOf(obj);
    }

    @BeforeClass
    public static void setup() {
        deepSizeOf(new CrossCheckingSizeOf(), new Object());
        System.out.println("Testing for a " + System.getProperty("java.version") + " JDK "
                           + ") on a " + System.getProperty("sun.arch.data.model") + "-bit VM "
                           + "(compressed-oops: " + COMPRESSED_OOPS
                           + ", Hotspot CMS: " + HOTSPOT_CMS
                           + ")");
    }

    @Test
    public void testAnnotationFiltering() throws Exception {
        SizeOf sizeOf = new CrossCheckingSizeOf(new AnnotationSizeOfFilter());

        assertThat(deepSizeOf(sizeOf, new AnnotationFilteredField()), allOf(greaterThan(128L), lessThan(16 * 1024L)));
        assertThat(deepSizeOf(sizeOf, new AnnotationFilteredClass()), equalTo(0L));
// Path: src/test/java/org/ehcache/sizeof/filteredtest/AnnotationFilteredPackage.java
// public class AnnotationFilteredPackage {
// 
//     private final byte[] bigArray = new byte[16 * 1024];
// }
// 
// Path: src/test/java/org/ehcache/sizeof/filteredtest/custom/CustomAnnotationFilteredPackage.java
// public class CustomAnnotationFilteredPackage {
// }


// Path: src/test/java/org/ehcache/sizeof/FilteredSizeOfTest.java
import org.ehcache.sizeof.annotations.IgnoreSizeOf;
import org.ehcache.sizeof.filteredtest.AnnotationFilteredPackage;
import org.ehcache.sizeof.filteredtest.custom.CustomAnnotationFilteredPackage;
import org.ehcache.sizeof.filters.AnnotationSizeOfFilter;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;

/**
 * Copyright Terracotta, 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 org.ehcache.sizeof;



/**
 * @author Alex Snaps
 */
public class FilteredSizeOfTest extends AbstractSizeOfTest {
    private static long deepSizeOf(SizeOf sizeOf, Object... obj) {
        return sizeOf.deepSizeOf(obj);
    }

    @BeforeClass
    public static void setup() {
        deepSizeOf(new CrossCheckingSizeOf(), new Object());
        System.out.println("Testing for a " + System.getProperty("java.version") + " JDK "
                           + ") on a " + System.getProperty("sun.arch.data.model") + "-bit VM "
                           + "(compressed-oops: " + COMPRESSED_OOPS
                           + ", Hotspot CMS: " + HOTSPOT_CMS
                           + ")");
    }

    @Test
    public void testAnnotationFiltering() throws Exception {
        SizeOf sizeOf = new CrossCheckingSizeOf(new AnnotationSizeOfFilter());

        assertThat(deepSizeOf(sizeOf, new AnnotationFilteredField()), allOf(greaterThan(128L), lessThan(16 * 1024L)));
        assertThat(deepSizeOf(sizeOf, new AnnotationFilteredClass()), equalTo(0L));
        assertThat(deepSizeOf(sizeOf, new AnnotationFilteredPackage()), equalTo(0L));