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