@@ -0,0 +1,3208 @@
+/*%0A * Copyright 2018 ZJNU ACM.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.github.zhanhb.judge.win32;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport jnc.foreign.Platform;%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized;%0A%0Aimport static com.github.zhanhb.judge.win32.IntegrityLevel.INTEGRITY_LEVEL_LAST;%0Aimport static com.github.zhanhb.judge.win32.IntegrityLevel.INTEGRITY_LEVEL_LOW;%0Aimport static com.github.zhanhb.judge.win32.TokenLevel.USER_LAST;%0Aimport static org.junit.Assume.assumeTrue;%0A%0A/**%0A *%0A * @author zhanhb%0A */%0A@Slf4j%0A@RunWith(Parameterized.class)%0Apublic class SandboxTest %7B%0A%0A    @BeforeClass%0A    public static void setUpClass() %7B%0A        assumeTrue(%22not windows%22, Platform.getNativePlatform().getOS().isWindows());%0A    %7D%0A%0A    @Parameterized.Parameters(name = %22%7Bindex%7D %7B0%7D %7B1%7D %7B2%7D %7B3%7D%22)%0A    public static List%3CObject%5B%5D%3E data() %7B%0A        ArrayList%3CObject%5B%5D%3E list = new ArrayList%3C%3E(56);%0A        TokenLevel%5B%5D tokenLevels = TokenLevel.values();%0A        IntegrityLevel%5B%5D integrityLevels = new IntegrityLevel%5B%5D%7BINTEGRITY_LEVEL_LOW, INTEGRITY_LEVEL_LAST%7D;%0A        TokenType%5B%5D tokenTypes = TokenType.values();%0A        boolean%5B%5D lockDowns = new boolean%5B%5D%7Btrue, false%7D;%0A        for (TokenLevel securityLevel : tokenLevels) %7B%0A            if (USER_LAST == securityLevel) %7B%0A                continue;%0A            %7D%0A            for (IntegrityLevel integrityLevel : integrityLevels) %7B%0A                for (TokenType tokenType : tokenTypes) %7B%0A                    for (boolean lockdownDefaultDacl : lockDowns) %7B%0A                        list.add(new Object%5B%5D%7BsecurityLevel, integrityLevel, tokenType, lockdownDefaultDacl%7D);%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return list;%0A    %7D%0A%0A    private final TokenLevel securityLevel;%0A    private final IntegrityLevel integrityLevel;%0A    private final TokenType tokenType;%0A    private final boolean lockdownDefaultDacl;%0A%0A    public SandboxTest(TokenLevel securityLevel, IntegrityLevel integrityLevel, TokenType tokenType, boolean lockdownDefaultDacl) %7B%0A        this.securityLevel = securityLevel;%0A        this.integrityLevel = integrityLevel;%0A        this.tokenType = tokenType;%0A        this.lockdownDefaultDacl = lockdownDefaultDacl;%0A    %7D%0A%0A    /**%0A     * Test of createRestrictedToken method, of class Sandbox.%0A     */%0A    @Test%0A    public void testCreateRestrictedToken() %7B%0A        log.info(%22CreateRestrictedToken%22);%0A        Sandbox instance = new Sandbox();%0A        Handle.close(instance.createRestrictedToken(securityLevel, integrityLevel, tokenType, lockdownDefaultDacl));%0A    %7D%0A%0A%7D%0A

Add SandboxTest