def getAmbiguitiesByOriginalForm(cls, model): """ generated source for method getAmbiguitiesByOriginalForm """ result = ArrayListMultimap.create() formsByName = getFormsByName(model) for name in formsByName.keySet(): for form in forms: result.putAll(form, getAmbiguities(form, forms)) allForms = ImmutableSet.copyOf(formsByName.values()) for ambiguity in result.values(): Assert.assertTrue(allForms.contains(ambiguity.getOriginal())) Assert.assertTrue(allForms.contains(ambiguity.getReplacement())) return result
// public void testHelloworld() { // // 1、获取SecurityManager工厂,此处使用Ini配置文件初始化SecurityManager // Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini"); //采用自带的iniRealm验证. //// Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro-realm.ini"); //采用自定义的Realm验证. //// Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro-multi-realm.ini"); //采用自定义的Realm验证. // // 2、得到SecurityManager实例 并绑定给SecurityUtils // SecurityManager securityManager = factory.getInstance(); // SecurityUtils.setSecurityManager(securityManager); // Subject subject = SecurityUtils.getSubject(); //// UsernamePasswordToken token = new UsernamePasswordToken("zhang", "1234"); // UsernamePasswordToken token = new UsernamePasswordToken("zhang", "123"); //// UsernamePasswordToken token = new UsernamePasswordToken("wang", "123"); //// // // 二 角色认证 // //判断拥有角色:role1 // Assert.assertTrue(subject.hasRole("role1")); // //判断拥有角色:role1 and role2 // Assert.assertTrue(subject.hasAllRoles(Arrays.asList("role1", "role2"))); // //判断拥有角色:role1 and role2 and !role3 // boolean[] result = subject.hasRoles(Arrays.asList("role1", "role2", "role3")); // Assert.assertEquals(true, result[0]); // Assert.assertEquals(true, result[1]); // Assert.assertEquals(false, result[2]); // try { // // 4、登录,即身份验证 // subject.login(token); // } catch (AuthenticationException e) { // // 5、身份验证失败 // } // Assert.assertEquals(true, subject.isAuthenticated()); // 断言用户已经登录 // // 6、退出
# Copyright (c) 2013-current, Terry Mathew Poulin <*****@*****.**> # # This software is provided 'as-is', without any express or implied warranty. # In no event will the authors be held liable for any damages arising from the # use of this software. # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and to alter it and redistribute it # freely, subject to the following restrictions: # # 1. The origin of this software must not be misrepresented; you must # not claim that you wrote the original software. If you use this # software in a product, an acknowledgment in the product # documentation would be appreciated but is not required. # # 2. Altered source versions must be plainly marked as such, and must # not be misrepresented as being the original software. # # 3. This notice may not be removed or altered from any source # distribution. # from org.junit import Assert from com.spidey01.sxe.scripting.testhelpers import JavaClass javaObject = JavaClass() Assert.assertEquals(true, javaObject.returnsTrue()) Assert.assertEquals(javaObject.returnsSum(2, 2), 4) Assert.assertEquals(javaObject.returnsStrCat("foo", "bar"), "foobar")