Java Code Examples for org.junit.Assert.assertNull()

The following are Jave code examples for showing how to use assertNull() of the org.junit.Assert class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: plugin-sso-salt   File: SaltedAuthenticationResourceTest.java   View Source Code Vote up 7 votes
@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));
}
 
Example 2
Project: linkifier   File: RegressionTest.java   View Source Code Vote up 6 votes
@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);
}
 
Example 3
Project: incubator-ratis   File: TestSegmentedRaftLog.java   View Source Code Vote up 6 votes
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);
  }
}
 
Example 4
Project: linkifier   File: RegressionTest.java   View Source Code Vote up 6 votes
@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);
}
 
Example 5
Project: ditb   File: TestRowDataTrivial.java   View Source Code Vote up 5 votes
@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());
}
 
Example 6
Project: crnk-framework   File: JpaQuerySpecEndToEndTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 7
Project: rskj   File: ProgramTest.java   View Source Code Vote up 5 votes
@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()));
}
 
Example 8
Project: DeskChan   File: LimitHashMapTests.java   View Source Code Vote up 5 votes
@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"));
}
 
Example 9
Project: bootstrap   File: AuditableTest.java   View Source Code Vote up 5 votes
/**
 * 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());
}
 
Example 10
Project: crnk-framework   File: QuerySpecClientTest.java   View Source Code Vote up 5 votes
@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());
}
 
Example 11
Project: smockin   File: RuleEngineTest.java   View Source Code Vote up 5 votes
@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);

}
 
Example 12
Project: shepher   File: PermissionMapperTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 13
Project: liferay-service-builder-dsl   File: OrderTest.java   View Source Code Vote up 5 votes
@Test
public void testBuild() {
	Order order = builder.build();

	Assert.assertNull(order.getBy());
	Assert.assertTrue(order.getOrderColumns().isEmpty());
}
 
Example 14
Project: JRediClients   File: RedissonBucketTest.java   View Source Code Vote up 5 votes
@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());
}
 
Example 15
Project: oscm   File: VatServiceBeanIT.java   View Source Code Vote up 5 votes
@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());
}
 
Example 16
Project: rskj   File: SecureTrieImplKeyValueTest.java   View Source Code Vote up 5 votes
@Test
public void getNullForUnknownKey() {
    TrieImpl trie = new TrieImpl(true);

    Assert.assertNull(trie.get(new byte[] { 0x01, 0x02, 0x03 }));
    Assert.assertNull(trie.get("foo"));
}
 
Example 17
Project: FX-Test   File: BaseTestFXComponentTest.java   View Source Code Vote up 4 votes
public void testInvalidUsername() {
	Assert.assertNull(component().status);
	rcontroller().cssFirst(".button").get().click();
	Assert.assertNotNull(component().status);
	Assert.assertEquals(1, component().status.getCode());
}
 
Example 18
Project: sunbird-utils   File: AzureServiceFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testGetObjectWithWrongType() {
  Object obj = CloudServiceFactory.get("Azure12");
  Assert.assertNull(obj);
}
 
Example 19
Project: bootstrap   File: BackendProxyServletTest.java   View Source Code Vote up 4 votes
@Test
public void filterServerResponseHeaderSkipExprires() {
	Assert.assertNull(servlet.filterServerResponseHeader(null, null, "Expires", null));
}
 
Example 20
Project: incubator-servicecomb-java-chassis   File: LocalServiceRegistryClientImplTest.java   View Source Code Vote up 4 votes
@Test
public void getMicroserviceId_appNotMatch() {
  mockRegisterMicroservice("otherApp", microserviceName, "1.0.0");

  Assert.assertNull(registryClient.getMicroserviceId(appId, microserviceName, "1.0.0"));
}