當前位置: 首頁>>代碼示例>>Java>>正文


Java Assert.assertNotEquals方法代碼示例

本文整理匯總了Java中org.junit.Assert.assertNotEquals方法的典型用法代碼示例。如果您正苦於以下問題:Java Assert.assertNotEquals方法的具體用法?Java Assert.assertNotEquals怎麽用?Java Assert.assertNotEquals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.Assert的用法示例。


在下文中一共展示了Assert.assertNotEquals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testUpdateByPrimaryKey

import org.junit.Assert; //導入方法依賴的package包/類
/**
 * 根據主鍵全更新
 */
@Test
public void testUpdateByPrimaryKey() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();
    try {
        UserInfoAbleMapper mapper = sqlSession.getMapper(UserInfoAbleMapper.class);
        UserInfoAble userInfo = mapper.selectByPrimaryKey(2);
        Assert.assertNotNull(userInfo);
        userInfo.setUsertype(null);
        userInfo.setEmail("[email protected]");
        userInfo.setAddress("這個地址不會更新進去");//update=false
        //不會更新username
        Assert.assertEquals(1, mapper.updateByPrimaryKey(userInfo));

        userInfo = mapper.selectByPrimaryKey(userInfo);
        Assert.assertNull(userInfo.getUsertype());
        Assert.assertNotEquals("這個地址不會更新進去", userInfo.getAddress());
        Assert.assertEquals("[email protected]", userInfo.getEmail());
    } finally {
        sqlSession.rollback();
        sqlSession.close();
    }
}
 
開發者ID:Yanweichen,項目名稱:MybatisGeneatorUtil,代碼行數:26,代碼來源:TestBasicAble.java

示例2: testEqualsAndHashCode

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testEqualsAndHashCode() {
    Person person = new Person();
    person.setName("張三");
    person.setAge(20);
    person.setSex("男");

    Person person2 = new Person();
    person2.setName("張三");
    person2.setAge(18);
    person2.setSex("男");

    Person person3 = new Person();
    person3.setName("李四");
    person3.setAge(20);
    person3.setSex("男");

    Assert.assertEquals(person, person2);
    Assert.assertNotEquals(person, person3);
}
 
開發者ID:dunwu,項目名稱:java-stack,代碼行數:21,代碼來源:LombokTest.java

示例3: testScopeBean

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testScopeBean() {
	ExampleScopeBean singletonBean1 = context.getBean("singletonBean", ExampleScopeBean.class);
	ExampleScopeBean singletonBean2 = context.getBean("singletonBean", ExampleScopeBean.class);
	ExampleScopeBean prototypeBean1 = context.getBean("prototypeBean", ExampleScopeBean.class);
	ExampleScopeBean prototypeBean2 = context.getBean("prototypeBean", ExampleScopeBean.class);

	Assert.assertEquals(singletonBean1, singletonBean2);
	Assert.assertNotEquals(prototypeBean1, prototypeBean2);

	//test singleton
	// check message
	Assert.assertEquals(singletonBean1.getMessage(), singletonBean2.getMessage());
	// update message
	singletonBean1.setMessage("new hello");
	// recheck message
	Assert.assertEquals(singletonBean1.getMessage(), singletonBean2.getMessage());

	//test prototype
	// check message
	Assert.assertEquals(prototypeBean1.getMessage(), prototypeBean2.getMessage());
	// update message
	prototypeBean1.setMessage("new hello");
	// recheck message
	Assert.assertNotEquals(prototypeBean1.getMessage(), prototypeBean2.getMessage());
}
 
開發者ID:lf23617358,項目名稱:training-sample,代碼行數:27,代碼來源:BeanTest.java

示例4: testCreateDynamicConfigNoConfigCenterSPI

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testCreateDynamicConfigNoConfigCenterSPI() {
  new Expectations(SPIServiceUtils.class) {
    {
      SPIServiceUtils.getTargetService(ConfigCenterConfigurationSource.class);
      result = null;
    }
  };

  AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig();
  MicroserviceConfigLoader loader = ConfigUtil.getMicroserviceConfigLoader(dynamicConfig);
  List<ConfigModel> list = loader.getConfigModels();
  Assert.assertEquals(loader, ConfigUtil.getMicroserviceConfigLoader(dynamicConfig));
  Assert.assertEquals(1, list.size());
  Assert.assertNotEquals(DynamicWatchedConfiguration.class,
      ((ConcurrentCompositeConfiguration) dynamicConfig).getConfiguration(0).getClass());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:18,代碼來源:TestConfigUtil.java

示例5: testCreateCheckoutToken

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testCreateCheckoutToken() {
    TokenService service = AfricasTalking.getService(TokenService.class);
    try {
        final CheckoutTokenResponse response = service.createCheckoutToken("0718769882");
        Assert.assertNotEquals("None", response.token);

    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
}
 
開發者ID:aksalj,項目名稱:africastalking-java,代碼行數:12,代碼來源:TokenTest.java

示例6: testPullRemoteChangesOnlyResultsInModifiedLocalDecisions

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testPullRemoteChangesOnlyResultsInModifiedLocalDecisions() throws Exception {
    seRepoTestServer.createCommit(TestDataProvider.createChangedTestSeItemsWithContentModified(),
            CommitMode.ADD_UPDATE);

    PULL_COMMAND.pull();

    Assert.assertNotEquals(commitId, COMMIT_COMMAND.readCommitId());
}
 
開發者ID:adr,項目名稱:eadlsync,代碼行數:10,代碼來源:PullCommandTest.java

示例7: testString

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testString() {
    Json s1 = Json.make("");
    Assert.assertEquals("", s1.getValue());
    Json s1dup = s1.dup();
    Assert.assertFalse(s1dup == s1);
    Assert.assertEquals(s1, s1dup);
    Json s2 = Json.make("string1");
    Json s2again = Json.factory().string("string1");
    Assert.assertEquals(s2, s2again);
    Json s3 = Json.make("Case Sensitive");
    Json s3_lower = Json.make("Case Sensitive".toLowerCase());
    Assert.assertNotEquals(s3, s3_lower);
}
 
開發者ID:junicorn,項目名稱:NiuBi,代碼行數:15,代碼來源:TestBasics.java

示例8: updateResource

import org.junit.Assert; //導入方法依賴的package包/類
@Override
public SearchService updateResource(SearchService resource) throws Exception {
    resource.createQueryKey("testKey1");

    resource = resource.update()
        .withTag("tag2", "value2")
        .withTag("tag3", "value3")
        .withoutTag("tag1")
        .withReplicaCount(1)
        .withPartitionCount(1)
        .apply();
    Assert.assertTrue(resource.tags().containsKey("tag2"));
    Assert.assertTrue(!resource.tags().containsKey("tag1"));
    Assert.assertEquals(1, resource.replicaCount());
    Assert.assertEquals(1, resource.partitionCount());
    Assert.assertEquals(2, resource.listQueryKeys().size());

    String adminKeyPrimary = resource.getAdminKeys().primaryKey();
    String adminKeySecondary = resource.getAdminKeys().secondaryKey();

    resource.deleteQueryKey(resource.listQueryKeys().get(1).key());
    resource.regenerateAdminKeys(AdminKeyKind.PRIMARY);
    resource.regenerateAdminKeys(AdminKeyKind.SECONDARY);
    Assert.assertEquals(1, resource.listQueryKeys().size());
    Assert.assertNotEquals(adminKeyPrimary, resource.getAdminKeys().primaryKey());
    Assert.assertNotEquals(adminKeySecondary, resource.getAdminKeys().secondaryKey());

    return resource;
}
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:30,代碼來源:TestSearchService.java

示例9: testClear

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testClear() throws SQLException, NoSuchFieldException, SecurityException, IllegalArgumentException,
		IllegalAccessException
{
	for (int i = 0; i < 2; i++)
	{
		MetaDataStore subject = new MetaDataStore(CloudSpannerTestObjects.createConnection());
		TableKeyMetaData fooUpperCase = subject.getTable("FOO");
		TableKeyMetaData fooLowerCase = subject.getTable("foo");
		TableKeyMetaData bar = subject.getTable("Bar");
		assertNotNull(fooLowerCase);
		assertNotNull(fooUpperCase);
		assertNotNull(bar);
		assertEquals(fooLowerCase, fooUpperCase);
		Assert.assertNotEquals(fooLowerCase, bar);

		Field field = MetaDataStore.class.getDeclaredField("tables");
		field.setAccessible(true);
		@SuppressWarnings("unchecked")
		Map<String, TableKeyMetaData> map = (Map<String, TableKeyMetaData>) field.get(subject);
		assertEquals(map.size(), 2);
		subject.clearTable("Foo");
		assertEquals(map.size(), 1);
		subject.clear();
		assertEquals(map.size(), 0);
	}
}
 
開發者ID:olavloite,項目名稱:spanner-jdbc,代碼行數:28,代碼來源:MetaDataStoreTest.java

示例10: testSetInputBufferSize

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testSetInputBufferSize() throws IOException {
  Assert.assertNotEquals(17, uncompressor.getInputBufferSize()); // Ensure test is valid
  uncompressor.setInputBufferSize(17); // Arbitrary non-default value
  Assert.assertEquals(17, uncompressor.getInputBufferSize());
  uncompressor.uncompress(compressedContentIn, uncompressedContentOut);
  Assert.assertArrayEquals(CONTENT, uncompressedContentOut.toByteArray());
}
 
開發者ID:lizhangqu,項目名稱:CorePatch,代碼行數:9,代碼來源:DeflateUncompressorTest.java

示例11: TestGetTemplateByUserIdEquals

import org.junit.Assert; //導入方法依賴的package包/類
/**
 * 驗證按照算法計算出來的ID屬於同一個數據庫;
 */
@Test
public void TestGetTemplateByUserIdEquals() {
	Assert.assertEquals(sharder.getTemplateByUserId(1081l),sharder.getTemplateByUserId(1063l));
	Assert.assertEquals(sharder.getTemplateByUserId(1081l),sharder.getTemplateByUserId(1049l));
	Assert.assertNotEquals(sharder.getTemplateByUserId(1081l),sharder.getTemplateByUserId(1079l));
}
 
開發者ID:jigsaw-projects,項目名稱:jigsaw-payment,代碼行數:10,代碼來源:TestJdbcSharder.java

示例12: testGetProxyByAnnotation4

import org.junit.Assert; //導入方法依賴的package包/類
@Test
//with super interface
public void testGetProxyByAnnotation4() {
    I4_1 c1 = new C4();
    I4_1 c2 = ProxyUtil.getProxyByAnnotation(c1, globalCacheConfig);
    Assert.assertNotEquals(c1.count(), c1.count());
    Assert.assertNotEquals(c1.countWithoutCache(), c1.countWithoutCache());
    Assert.assertEquals(c2.count(), c2.count());
    Assert.assertNotEquals(c2.countWithoutCache(), c2.countWithoutCache());
}
 
開發者ID:alibaba,項目名稱:jetcache,代碼行數:11,代碼來源:ProxyUtilTest.java

示例13: findByCategoryTypeIn

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void findByCategoryTypeIn() {
    List<Integer> list = Arrays.asList(2, 3, 4);

    List<ProductCategory> productCategoryList = productCategoryRepository.findByCategoryTypeIn(list);
    Assert.assertNotEquals(0, productCategoryList.size());
}
 
開發者ID:ldlood,項目名稱:SpringBoot_Wechat_Sell,代碼行數:8,代碼來源:ProductCategoryRepositoryTest.java

示例14: before

import org.junit.Assert; //導入方法依賴的package包/類
@Before
public void before() throws IOException, InterruptedException, ExecutionException {
	web3j = Web3j.build(new HttpService());

	EthAccounts accounts = web3j.ethAccounts().send();
	Assert.assertNotEquals(0, accounts.getAccounts().size());

	// use the first account as the main account for the tests
	mainAccountAddress = accounts.getAccounts().get(0);

	// deploy the contract
	txManager = new ClientTransactionManager(web3j, mainAccountAddress);
	bankAccountContract = BankAccount.deploy(web3j, txManager, GAS_PRICE, GAS_LIMIT, BigInteger.valueOf(0))
			.get();
}
 
開發者ID:SenthuranSivananthan,項目名稱:devops-blockchain-jenkins,代碼行數:16,代碼來源:BankAccountSmartContractTests.java

示例15: runEmpty

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void runEmpty() throws Exception {
    Application application = new TestApplication();
    Assert.assertNotEquals(RUN_STATUS_OK, application.run(new String[]{}));
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:6,代碼來源:ApplicationTest.java


注:本文中的org.junit.Assert.assertNotEquals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。