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


Java Assert.assertNull方法代碼示例

本文整理匯總了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));
}
 
開發者ID:ligoj,項目名稱:plugin-sso-salt,代碼行數:8,代碼來源:SaltedAuthenticationResourceTest.java

示例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);
}
 
開發者ID:janmotl,項目名稱:linkifier,代碼行數:17,代碼來源:RegressionTest.java

示例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);
  }
}
 
開發者ID:apache,項目名稱:incubator-ratis,代碼行數:26,代碼來源:TestSegmentedRaftLog.java

示例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);
}
 
開發者ID:janmotl,項目名稱:linkifier,代碼行數:25,代碼來源:RegressionTest.java

示例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());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:12,代碼來源:TestRowDataTrivial.java

示例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);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:15,代碼來源:JpaQuerySpecEndToEndTest.java

示例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()));
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:10,代碼來源:ProgramTest.java

示例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"));
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:13,代碼來源:LimitHashMapTests.java

示例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());
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:13,代碼來源:AuditableTest.java

示例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());
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:32,代碼來源:QuerySpecClientTest.java

示例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);

}
 
開發者ID:mgtechsoftware,項目名稱:smockin,代碼行數:15,代碼來源:RuleEngineTest.java

示例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);
}
 
開發者ID:XiaoMi,項目名稱:shepher,代碼行數:13,代碼來源:PermissionMapperTest.java

示例13: testBuild

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testBuild() {
	Order order = builder.build();

	Assert.assertNull(order.getBy());
	Assert.assertTrue(order.getOrderColumns().isEmpty());
}
 
開發者ID:mdelapenya,項目名稱:liferay-service-builder-dsl,代碼行數:8,代碼來源:OrderTest.java

示例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());
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:11,代碼來源:RedissonBucketTest.java

示例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());
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:14,代碼來源:VatServiceBeanIT.java


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