本文整理匯總了Java中org.junit.Assert.assertNull方法的典型用法代碼示例。如果您正苦於以下問題:Java Assert.assertNull方法的具體用法?Java Assert.assertNull怎麽用?Java Assert.assertNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.Assert
的用法示例。
在下文中一共展示了Assert.assertNull方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetTokenFromUser
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testGetTokenFromUser() throws Exception {
Mockito.when(userRepository.getToken("any")).thenReturn(null);
Mockito.when(userRepository.getToken(null)).thenReturn(null);
Assert.assertNull(resource.getSsoToken("any"));
Assert.assertNull(resource.getSsoToken(null));
}
示例2: test476
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void test476() throws Throwable {
if (debug)
System.out.format("%n%s%n", "RegressionTest0.test476");
Column column2 = new Column(",", "");
column2.setEstimatedRowCount((int) (byte) 0);
column2.setBestAttemptPk(false);
String str7 = column2.getName();
column2.setTableContainsLob(true);
column2.setEstimatedPk(false);
String str12 = column2.getTextMin();
column2.setDataTypeName("schema,table,column,dataTypeName,isUnique,isUniqueConstraint,columnSize,decimalDigits,isDecimal,hasDefault,ordinalPosition,ordinalPositionEnd,tableColumnCount,tableContainsLob,estimatedRowCount,isAutoincrement,isNotNull,nullRatio,isNullable,uniqueRatio,minValue,maxValue,avgWidth,avgWidthBigger10,correlationAbs,isKeywordSingleton,isJunctionTable,hasMultiplePK,levenshteinDistance,minLDOtherTable,isDoppelganger,contains,isPrimaryKey");
column2.setUniqueRatio(0.0d);
Assert.assertTrue("'" + str7 + "' != '" + "" + "'", str7.equals(""));
Assert.assertNull(str12);
}
示例3: testTruncate
import org.junit.Assert; //導入方法依賴的package包/類
private void testTruncate(List<LogEntryProto> entries, long fromIndex)
throws Exception {
try (SegmentedRaftLog raftLog =
new SegmentedRaftLog(peerId, null, storage, -1, properties)) {
raftLog.open(RaftServerConstants.INVALID_LOG_INDEX, null);
// truncate the log
raftLog.truncate(fromIndex).join();
checkEntries(raftLog, entries, 0, (int) fromIndex);
}
try (SegmentedRaftLog raftLog =
new SegmentedRaftLog(peerId, null, storage, -1, properties)) {
raftLog.open(RaftServerConstants.INVALID_LOG_INDEX, null);
// check if the raft log is correct
if (fromIndex > 0) {
Assert.assertEquals(entries.get((int) (fromIndex - 1)),
getLastEntry(raftLog));
} else {
Assert.assertNull(raftLog.getLastEntryTermIndex());
}
checkEntries(raftLog, entries, 0, (int) fromIndex);
}
}
示例4: test090
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void test090() throws Throwable {
if (debug)
System.out.format("%n%s%n", "RegressionTest0.test090");
Table table2 = new Table("", ",");
table2.setTrimmedName("hi!");
String str5 = table2.getLowerCaseTrimmedName();
String str6 = table2.toProbability();
Table[] table_array7 = new Table[] {};
ArrayList<Table> arraylist_table8 = new ArrayList<>();
boolean b9 = Collections.addAll(arraylist_table8, table_array7);
List<Table> list_table10 = Optimization.optimize(arraylist_table8);
Connection connection11 = null;
List<Table> list_table13 = Schema.getExpensiveFeatures(arraylist_table8, connection11, "");
List<Table> list_table14 = Optimization.optimize(list_table13);
table2.isJunctionTable(list_table14);
Assert.assertNull(str5);
Assert.assertTrue("'" + str6 + "' != '" + "" + "'", str6.equals(""));
Assert.assertNotNull(table_array7);
Assert.assertTrue(b9 == false);
Assert.assertNotNull(list_table10);
Assert.assertNotNull(list_table13);
Assert.assertNotNull(list_table14);
}
示例5: individualSearcherAssertions
import org.junit.Assert; //導入方法依賴的package包/類
@Override
public void individualSearcherAssertions(CellSearcher searcher) {
/**
* The searcher should get a token mismatch on the "r" branch. Assert that it skips not only rA,
* but rB as well.
*/
KeyValue afterLast = KeyValueUtil.createFirstOnRow(Bytes.toBytes("zzz"));
CellScannerPosition position = searcher.positionAtOrAfter(afterLast);
Assert.assertEquals(CellScannerPosition.AFTER_LAST, position);
Assert.assertNull(searcher.current());
}
示例6: testFindOneTargetWithNullResult
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testFindOneTargetWithNullResult() throws InstantiationException, IllegalAccessException {
TestEntity test = new TestEntity();
test.setId(2L);
test.setStringValue("test");
testRepo.create(test);
RelationshipRepositoryV2<TestEntity, Serializable, RelatedEntity, Serializable> relRepo = client
.getQuerySpecRepository(TestEntity.class, RelatedEntity.class);
RelatedEntity related =
relRepo.findOneTarget(test.getId(), TestEntity.ATTR_oneRelatedValue, new QuerySpec(RelatedEntity.class));
Assert.assertNull(related);
}
示例7: sendFailsAndReturnsFalseThenExecutionContinuesNormally
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void sendFailsAndReturnsFalseThenExecutionContinuesNormally() {
ProgramResult result = TestContract.sendTest().executeFunction("test", BigInteger.TEN);
Assert.assertFalse(result.isRevert());
Assert.assertNull(result.getException());
Assert.assertArrayEquals(
new Object[] { BigInteger.valueOf(42) },
TestContract.sendTest().functions.get("test").decodeResult(result.getHReturn()));
}
示例8: test0
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void test0(){
Assert.assertEquals(lhm.size(),5);
Assert.assertNull(lhm.get("a"));
Assert.assertNull(lhm.get("b"));
Assert.assertTrue(lhm.get("c")==28);
Assert.assertNotNull(lhm.get("c"));
Assert.assertNotNull(lhm.get("d"));
Assert.assertNotNull(lhm.get("e"));
Assert.assertNotNull(lhm.get("f"));
Assert.assertNotNull(lhm.get("g"));
}
示例9: testAuditVoNull
import org.junit.Assert; //導入方法依賴的package包/類
/**
* Null Audit VO copy
*/
@Test
public void testAuditVoNull() {
final AuditedBean<String, Integer> auditedVo = new AuditedBean<>();
auditedVo.copyAuditData(null);
Assert.assertNull(auditedVo.getCreatedBy());
Assert.assertNull(auditedVo.getLastModifiedBy());
Assert.assertNull(auditedVo.getCreatedDate());
Assert.assertNull(auditedVo.getLastModifiedDate());
}
示例10: testCannotNullLazyRelationWithSave
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testCannotNullLazyRelationWithSave() {
Task task = new Task();
task.setId(2L);
task.setName("test");
taskRepo.create(task);
Schedule schedule = new Schedule();
schedule.setId(1L);
schedule.setName("schedule");
schedule.setLazyTask(task);
scheduleRepo.create(schedule);
// since lazy, will not be sent to client if not requested
QuerySpec querySpec = new QuerySpec(Schedule.class);
Schedule savedSchedule = scheduleRepo.findOne(schedule.getId(), querySpec);
Assert.assertNull(savedSchedule.getLazyTask());
querySpec.includeRelation(Arrays.asList("lazyTask"));
savedSchedule = scheduleRepo.findOne(schedule.getId(), querySpec);
Assert.assertNotNull(savedSchedule.getLazyTask());
// null
savedSchedule.setLazyTask(task);
scheduleRepo.save(savedSchedule);
// still not null because cannot differantiate between not loaded and
// nulled
Schedule updatedSchedule = scheduleRepo.findOne(schedule.getId(), querySpec);
Assert.assertNotNull(updatedSchedule.getLazyTask());
}
示例11: extractInboundValue_jsonReqBody_null_Test
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void extractInboundValue_jsonReqBody_null_Test() {
// Setup
final String fieldName = "username";
Mockito.when(req.body()).thenReturn(null);
// Test
final String result = ruleEngine.extractInboundValue(RuleMatchingTypeEnum.REQUEST_BODY_JSON_ANY, fieldName, req);
// Assertions
Assert.assertNull(result);
}
示例12: testGet
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testGet() {
String cluster = "local_test";
String path = "/test";
String noPath = "/no/such/pah";
Permission permission = permissionMapper.get(cluster, path);
Assert.assertEquals(3, permission.getId());
Permission noPermission = permissionMapper.get(cluster, noPath);
Assert.assertNull(noPermission);
}
示例13: testBuild
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testBuild() {
Order order = builder.build();
Assert.assertNull(order.getBy());
Assert.assertTrue(order.getOrderColumns().isEmpty());
}
示例14: testSetExist
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testSetExist() {
RBucket<String> bucket = redisson.getBucket("test");
Assert.assertNull(bucket.get());
String value = "somevalue";
bucket.set(value);
Assert.assertEquals(value, bucket.get());
Assert.assertTrue(bucket.isExists());
}
示例15: testSaveDefaultVat_vatNull
import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testSaveDefaultVat_vatNull() throws Exception {
createDefaultVat(BigDecimal.ZERO);
createCountryVat(TEN);
createOrganizationVat(TEN);
vatService.saveDefaultVat(null);
Assert.assertNull(vatService.getDefaultVat());
Assert.assertEquals(0, vatService.getCountryVats().size());
Assert.assertEquals(0, vatService.getOrganizationVats().size());
Assert.assertFalse(vatService.getVatSupport());
}