当前位置: 首页>>代码示例>>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;未经允许,请勿转载。