package com.speedment.common.codegenxml;

import com.speedment.common.codegen.internal.model.FieldImpl;
import com.speedment.common.codegen.model.Field;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;

/**
 * @author Per Minborg
 */
final class EncapsulationTest {


    @Test
    void internalNotAccessible() {
        assertThrows(IllegalAccessError.class, () -> new FieldImpl("s", String.class), "The module com.speedment.common.codegen is not encapsulated");
    }

    @Test
    void deepReflection() {
        final Field f = Field.of("s", String.class);

        try {
            f.getClass().getDeclaredField("name").setAccessible(true);
        } catch (Exception e) {
            if ("InaccessibleObjectException".equals(e.getClass().getSimpleName())) {
                return;
            }
        }
        fail("The module com.speedment.common.codegen is not encapsulated for deep reflection");
    }
}



@@ -146,16 +146,55 @@
 .Field;%0A
+import org.junit.jupiter.api.Disabled;%0A
 import o
@@ -367,16 +367,75 @@
 org%0A */%0A
+@Disabled(%22This test does not work for Jenkins, See #815%22)%0A
 final cl

Disable test, See #815