本文整理匯總了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();
}
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}
}
示例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());
}
示例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));
}
示例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());
}
示例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());
}
示例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[]{}));
}