當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。