当前位置: 首页>>代码示例>>Java>>正文


Java Assert.assertNotEquals方法代码示例

本文整理汇总了Java中org.testng.Assert.assertNotEquals方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertNotEquals方法的具体用法?Java Assert.assertNotEquals怎么用?Java Assert.assertNotEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.Assert的用法示例。


在下文中一共展示了Assert.assertNotEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEquals

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testEquals() {
    String messageID = getRandomString();
    String messageContent = getRandomString();
    Metadata randomMetadata = new Metadata(Signal.ACKNOWLEDGE, getRandomString());
    PubSubMessage message1 = new PubSubMessage(messageID, messageContent, randomMetadata);
    PubSubMessage message2 = new PubSubMessage(messageID, messageContent, new Metadata(Signal.ACKNOWLEDGE, getRandomString()));
    PubSubMessage message3 = new PubSubMessage(getRandomString(), messageContent, randomMetadata);
    PubSubMessage message4 = new PubSubMessage(messageID, messageContent, randomMetadata, 2);

    Assert.assertEquals(message1, message2);
    Assert.assertNotEquals(message1, message3);
    Assert.assertNotEquals(message1, message4);
    Assert.assertFalse(message1.equals(null));
    Assert.assertFalse(message1.equals(new PubSubException("Dummy")));
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:17,代码来源:PubSubMessageTest.java

示例2: deepClone_should_clone_Arraysof_NestedObjects_and_return_cloned_Object

import org.testng.Assert; //导入方法依赖的package包/类
@Test(groups = "ModelsUtils.deepClone")
void deepClone_should_clone_Arraysof_NestedObjects_and_return_cloned_Object()
        throws IllegalAccessException {
    SearchFilesRequest oldObj1 = new SearchFilesRequest();
    ModelsUtilTest.initializeSearchFilesObject(oldObj1);
    SearchFilesRequest oldObj2 = new SearchFilesRequest();
    ModelsUtilTest.initializeSearchFilesObject(oldObj2);
    oldObj2.getSearchParams().setFilterContentTypePhoto(true);
    SearchFilesRequest[] oldRequestArray = { oldObj1, oldObj2 };
    SearchFilesRequest[] newRequestArray = (SearchFilesRequest[]) ModelsUtil
            .deepClone(oldRequestArray);
    Assert.assertNotEquals(oldRequestArray, newRequestArray);
    Assert.assertTrue(validateFields(oldRequestArray[0].getSearchParams(),
            newRequestArray[0].getSearchParams()));
    newRequestArray[0].getSearchParams().setFilterOrientation(
            AssetOrientation.HORIZONTAL);
    oldRequestArray[0].getSearchParams().setFilterOrientation(
            AssetOrientation.HORIZONTAL);
    Assert.assertNotEquals(oldRequestArray, newRequestArray);
}
 
开发者ID:adobe,项目名称:stock-api-sdk,代码行数:21,代码来源:ModelsUtilTest.java

示例3: testEqualsThisHasNoAttributes

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testEqualsThisHasNoAttributes() {
    PolicyEvaluationRequestV1 a = new PolicyEvaluationRequestV1();
    a.setSubjectIdentifier("subject");
    a.setAction("GET");
    a.setResourceIdentifier("/resource");

    PolicyEvaluationRequestV1 b = new PolicyEvaluationRequestV1();
    b.setSubjectIdentifier("subject");
    b.setAction("GET");
    b.setResourceIdentifier("/resource");
    b.setSubjectAttributes(
            new HashSet<Attribute>(
                    Arrays.asList(
                            new Attribute[] {
                                    new Attribute("issuer", "role"),
                                    new Attribute("issuer", "group")
                            })));
    Assert.assertNotEquals(a, b);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:21,代码来源:PolicyEvaluationRequestV1Test.java

示例4: testHashCodeThatHasNoAttributes

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testHashCodeThatHasNoAttributes() {
    PolicyEvaluationRequestV1 a = new PolicyEvaluationRequestV1();
    a.setSubjectIdentifier("subject");
    a.setAction("GET");
    a.setResourceIdentifier("/resource");
    a.setSubjectAttributes(
            new HashSet<Attribute>(
                    Arrays.asList(
                            new Attribute[] {
                                    new Attribute("issuer", "role"),
                                    new Attribute("issuer", "group")
                            })));

    PolicyEvaluationRequestV1 b = new PolicyEvaluationRequestV1();
    b.setSubjectIdentifier("subject");
    b.setAction("GET");
    b.setResourceIdentifier("/resource");
    Assert.assertNotEquals(a.hashCode(), b.hashCode());
}
 
开发者ID:eclipse,项目名称:keti,代码行数:21,代码来源:PolicyEvaluationRequestV1Test.java

示例5: testNullFieldsForHashCode

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testNullFieldsForHashCode() {
    GroupOperation a = new GroupOperation(null, null, "a");
    GroupOperation b = new GroupOperation(null, "foo", "a");
    GroupOperation c = new GroupOperation(null, "bar", "a");
    GroupOperation d = new GroupOperation(null, null, "b");
    GroupOperation e = new GroupOperation(GroupOperationType.AVG, null, "avg");

    Assert.assertNotEquals(a.hashCode(), b.hashCode());
    Assert.assertNotEquals(a.hashCode(), c.hashCode());
    Assert.assertNotEquals(b.hashCode(), c.hashCode());
    Assert.assertEquals(a.hashCode(), d.hashCode());
    Assert.assertNotEquals(a.hashCode(), e.hashCode());
    Assert.assertNotEquals(b.hashCode(), e.hashCode());
    Assert.assertNotEquals(c.hashCode(), e.hashCode());
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:17,代码来源:GroupOperationTest.java

示例6: testGetSession

import org.testng.Assert; //导入方法依赖的package包/类
@Test(dataProvider = "getSessionManager")
public void testGetSession(WxSessionManager sessionManager) {

  WxSession session1 = sessionManager.getSession("abc");
  WxSession session2 = sessionManager.getSession("abc");
  Assert.assertEquals(session1, session2);
  Assert.assertTrue(session1 == session2);

  WxSession abc1 = sessionManager.getSession("abc1");
  Assert.assertNotEquals(session1, abc1);

  WxSession abc1b = sessionManager.getSession("abc1", false);
  Assert.assertEquals(abc1, abc1b);

  WxSession def = sessionManager.getSession("def", false);
  Assert.assertNull(def);

}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:19,代码来源:SessionTest.java

示例7: testEqualsThatHasNoAttributes

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testEqualsThatHasNoAttributes() {
    PolicyEvaluationRequestV1 a = new PolicyEvaluationRequestV1();
    a.setSubjectIdentifier("subject");
    a.setAction("GET");
    a.setResourceIdentifier("/resource");
    a.setSubjectAttributes(
            new HashSet<Attribute>(
                    Arrays.asList(
                            new Attribute[] {
                                    new Attribute("issuer", "role"),
                                    new Attribute("issuer", "group")
                            })));

    PolicyEvaluationRequestV1 b = new PolicyEvaluationRequestV1();
    b.setSubjectIdentifier("subject");
    b.setAction("GET");
    b.setResourceIdentifier("/resource");
    Assert.assertNotEquals(a, b);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:21,代码来源:PolicyEvaluationRequestV1Test.java

示例8: testHashCode

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testHashCode() {
    GroupOperation a = new GroupOperation(GroupOperationType.AVG, "foo", "avg1");
    GroupOperation b = new GroupOperation(GroupOperationType.AVG, "foo", "avg2");
    GroupOperation c = new GroupOperation(GroupOperationType.AVG, "bar", "avg1");
    GroupOperation d = new GroupOperation(GroupOperationType.COUNT, "foo", "count1");
    GroupOperation e = new GroupOperation(GroupOperationType.COUNT, "bar", "count2");

    Assert.assertEquals(a.hashCode(), b.hashCode());
    Assert.assertNotEquals(a.hashCode(), c.hashCode());
    Assert.assertNotEquals(a.hashCode(), d.hashCode());
    Assert.assertNotEquals(c.hashCode(), d.hashCode());
    Assert.assertNotEquals(a.hashCode(), e.hashCode());
    Assert.assertNotEquals(c.hashCode(), e.hashCode());
    Assert.assertNotEquals(d.hashCode(), e.hashCode());
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:17,代码来源:GroupOperationTest.java

示例9: deepClone_should_clone_Primitives_and_return_cloned_Object

import org.testng.Assert; //导入方法依赖的package包/类
@Test(groups = "ModelsUtils.deepClone")
void deepClone_should_clone_Primitives_and_return_cloned_Object()
        throws IllegalAccessException {

    PrimitivesOnly oldObj = new PrimitivesOnly();
    oldObj.initializePrimitives();
    PrimitivesOnly newObj = (PrimitivesOnly) ModelsUtil.deepClone(oldObj);
    Assert.assertNotEquals(oldObj, newObj);
    validateFields(oldObj, newObj);

    oldObj.stringVal = "NewValue";
    newObj.byteVal = 100;
    Assert.assertNotEquals(oldObj.stringVal, newObj.stringVal);
    Assert.assertNotEquals(oldObj.byteVal, newObj.byteVal);
}
 
开发者ID:adobe,项目名称:stock-api-sdk,代码行数:16,代码来源:ModelsUtilTest.java

示例10: deepClone_should_clone_Collectionsand_return_cloned_Object

import org.testng.Assert; //导入方法依赖的package包/类
@Test(groups = "ModelsUtils.deepClone")
void deepClone_should_clone_Collectionsand_return_cloned_Object()
        throws IllegalAccessException {
    CollectionsOnly oldObj = new CollectionsOnly();
    oldObj.initializeCollections();
    CollectionsOnly newObj = (CollectionsOnly) ModelsUtil.deepClone(oldObj);
    Assert.assertNotEquals(oldObj, newObj);
    Assert.assertEquals(true, validateFields(oldObj, newObj));
    newObj.list.add(1, 10);
    newObj.set.add('z');
    Assert.assertEquals(false, validateFields(oldObj, newObj));
    Assert.assertNotEquals(oldObj.list.get(1), newObj.list.get(1));
    Assert.assertNotEquals(newObj.set.contains('z'),
            oldObj.set.contains('z'));
}
 
开发者ID:adobe,项目名称:stock-api-sdk,代码行数:16,代码来源:ModelsUtilTest.java

示例11: testNullFieldsForEquals

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testNullFieldsForEquals() {
    GroupOperation a = new GroupOperation(null, null, "a");
    GroupOperation b = new GroupOperation(null, "foo", "a");
    GroupOperation c = new GroupOperation(null, "bar", "a");
    GroupOperation d = new GroupOperation(null, null, "a");

    Assert.assertNotEquals(a, b);
    Assert.assertNotEquals(a, c);
    Assert.assertNotEquals(b, c);
    Assert.assertEquals(a, d);
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:13,代码来源:GroupOperationTest.java

示例12: oneResource

import org.testng.Assert; //导入方法依赖的package包/类
@Test public void oneResource() {
    final DateTime time = service.getLastReloadAttemptInstant();
    service.setServiceConfigurations(oneResolver);
    service.reload();
    Assert.assertNotEquals(time, service.getLastReloadAttemptInstant());
    final ServiceableComponent<RefreshableClientInformationResolver> component = service.getServiceableComponent();
    final ClientInformationResolver resolver = component.getComponent();
    component.unpinComponent();
    Assert.assertEquals(getChainSize(resolver), 1);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:11,代码来源:ReloadClientResolverServiceConfigurationTest.java

示例13: testEncryptCompleteFlow

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testEncryptCompleteFlow() {
    Encryptor encryption = new Encryptor();
    encryption.setEncryptionKey("FooBarFooBarFooB");
    Assert.assertNotEquals(encryption.encrypt(VALUE_TO_ENCRYPT), VALUE_TO_ENCRYPT);
    Assert.assertEquals(encryption.decrypt(encryption.encrypt(VALUE_TO_ENCRYPT)), VALUE_TO_ENCRYPT);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:8,代码来源:EncryptorTest.java

示例14: serviceAction

import org.testng.Assert; //导入方法依赖的package包/类
@Test public void serviceAction() throws ComponentInitializationException {
    final DateTime time = service.getLastReloadAttemptInstant();

    final MockHttpServletResponse response = new MockHttpServletResponse();
    
    final ReloadServiceConfiguration action =
            ReloadClientResolverServiceConfigurationTest.initializeAction(service, response);
    final Event event = action.execute(src);
    ActionTestingSupport.assertProceedEvent(event);

    Assert.assertNotEquals(time, service.getLastReloadAttemptInstant());
    Assert.assertEquals(response.getStatus(), HttpServletResponse.SC_OK);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:14,代码来源:ReloadProviderResolverServiceConfigurationTest.java

示例15: update

import org.testng.Assert; //导入方法依赖的package包/类
@Override
public void update ()
{
   String id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2";
   String reason = "Test update reason";
   AccessRestriction ar = dao.read (id);

   Assert.assertNotEquals (ar.getBlockingReason (), reason);
   ar.setBlockingReason (reason);
   dao.update (ar);

   ar = dao.read (id);
   Assert.assertEquals (ar.getBlockingReason (), reason);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:15,代码来源:TestAccessRestrictionDao.java


注:本文中的org.testng.Assert.assertNotEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。