### Question:
KieServerTypePermission extends WildcardTypePermission { @SuppressWarnings("rawtypes") @Override public boolean allows(Class type) { boolean allowed = super.allows(type); if (!allowed) { allowed = classes.contains(type); if (!allowed && type.getClassLoader() instanceof KieTypeResolver) { allowed = true; } } return allowed; } KieServerTypePermission(Set<Class<?>> classes); @SuppressWarnings("rawtypes") @Override boolean allows(Class type);  }### Answer:
@Test public void testDefaultAcceptableClasses() { KieServerTypePermission permission = new KieServerTypePermission(new HashSet<>()); assertTrue(permission.allows(KieContainerResource.class)); assertTrue(permission.allows(ProcessDefinition.class)); assertTrue(permission.allows(EmailNotification.class)); assertTrue(permission.allows(CaseDefinition.class)); assertTrue(permission.allows(DMNModelInfo.class)); }
@Test public void testDefaultForbiddenClasses() { KieServerTypePermission permission = new KieServerTypePermission(new HashSet<>()); assertFalse(permission.allows(Top.class)); }
@Test public void testExplicitlyGivenClasses() { Set<Class<?>> classes = new HashSet<>(); classes.add(Top.class); KieServerTypePermission permission = new KieServerTypePermission(classes); assertTrue(permission.allows(Top.class)); }
@Test public void testSystemPropertyGivenClasses() { System.setProperty(SYSTEM_XSTREAM_ENABLED_PACKAGES, "org.kie.server.api.marshalling.objects.Top,org.kie.server.api.marshalling.objects.Message"); Set<Class<?>> classes = new HashSet<>(); KieServerTypePermission permission = new KieServerTypePermission(classes); assertTrue(permission.allows(Top.class)); assertTrue(permission.allows(Message.class)); assertFalse(permission.allows(AnotherMessage.class)); }