@@ -0,0 +1,2777 @@
+/*%0A * Copyright 2013 Steve Chaloner%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 be.objectify.deadbolt.java;%0A%0Aimport java.io.Serializable;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport be.objectify.deadbolt.java.models.DefaultSubject;%0Aimport be.objectify.deadbolt.java.models.Permission;%0Aimport be.objectify.deadbolt.java.models.Role;%0Aimport be.objectify.deadbolt.java.models.Subject;%0A%0A/**%0A * @author Matthias Kurz (m.kurz@irregular.at)%0A */%0Apublic class DefaultSubjectTest%0A%7B%0A    private final static List%3CString%3E ROLES = Arrays.asList(%22admin%22, %22support%22);%0A    private final static List%3CString%3E PERMISSIONS = Arrays.asList(%22createuser%22, %22dropuser%22, %22createdocument%22, %22dropdocument%22);%0A%0A    private Subject testSubject;%0A%0A    @Before%0A    public void setUp()%0A    %7B%0A        this.testSubject = new DefaultSubject(%229876%22, ROLES, PERMISSIONS);%0A    %7D%0A%0A    @Test%0A    public void testDefaultSubjectInstance()%0A    %7B%0A        Assert.assertTrue(this.testSubject instanceof DefaultSubject);%0A        Assert.assertTrue(this.testSubject instanceof Serializable);%0A        Assert.assertTrue(this.testSubject.getIdentifier().equals(%229876%22));%0A    %7D%0A%0A    @Test%0A    public void testRoleInstances()%0A    %7B%0A        Assert.assertTrue(this.testSubject.getRoles().size() == 2);%0A        final List%3CString%3E rolesFromSubject = this.testSubject.getRoles().stream().peek(role -%3E Assert.assertTrue(role instanceof Role && role instanceof Serializable))%0A            .map(role -%3E role.getName()).collect(Collectors.toList());%0A        ROLES.stream().forEach(role -%3E Assert.assertTrue(rolesFromSubject.contains(role)));%0A    %7D%0A%0A    @Test%0A    public void testPermissionsInstances()%0A    %7B%0A        Assert.assertTrue(this.testSubject.getPermissions().size() == 4);%0A        final List%3CString%3E permissionsFromSubject = this.testSubject.getPermissions().stream().peek(permission -%3E Assert.assertTrue(permission instanceof Permission && permission instanceof Serializable))%0A            .map(permission -%3E permission.getValue()).collect(Collectors.toList());%0A        PERMISSIONS.stream().forEach(permission -%3E Assert.assertTrue(permissionsFromSubject.contains(permission)));%0A    %7D%0A%0A%7D%0A

Add DefaultSubjectTest