本文整理了Java中junit.framework.TestCase.assertNull()
方法的一些代码示例,展示了TestCase.assertNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestCase.assertNull()
方法的具体详情如下:
包路径:junit.framework.TestCase
类名称:TestCase
方法名:assertNull
[英]Asserts that an object is null. If it isn't an AssertionError is thrown. Message contains: Expected: but was: object
[中]断言对象为空。如果不是断言,则抛出断言错误。消息包含:应为:但为:对象
代码示例来源:origin: google/guava
void check() {
runTester();
@SuppressWarnings("unchecked") // We are checking it anyway
Converter<String, Integer> defaultConverter =
(Converter<String, Integer>) getDefaultParameterValue(0);
assertEquals(Integer.valueOf(0), defaultConverter.convert("anything"));
assertEquals("", defaultConverter.reverse().convert(123));
assertNull(defaultConverter.convert(null));
assertNull(defaultConverter.reverse().convert(null));
}
}
代码示例来源:origin: jankotek/mapdb
public void realRun() throws InterruptedException {
assertNull(q.poll());
threadsStarted.await();
assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
checkEmpty(q);
}});
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testDeleteCascadeM2OAssociationsOnMSideWithNoParameter() {
createClassroomStudentsTeachers();
int rowsAffected = gameRoom.delete();
assertEquals(5, rowsAffected);
assertNull(getClassroom(gameRoom.get_id()));
assertNull(getStudent(jude.getId()));
assertNull(getStudent(rose.getId()));
assertNull(getTeacher(john.getId()));
assertNull(getTeacher(mike.getId()));
}
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testDeleteCascadeM2OAssociationsOnMSideById() {
createClassroomStudentsTeachers();
int rowsAffected = LitePal.delete(Classroom.class, gameRoom.get_id());
assertEquals(5, rowsAffected);
assertNull(getClassroom(gameRoom.get_id()));
assertNull(getStudent(jude.getId()));
assertNull(getStudent(rose.getId()));
assertNull(getTeacher(john.getId()));
assertNull(getTeacher(mike.getId()));
}
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testDeleteAllCascadeM2OAssociationsOnMSide() {
createClassroomStudentsTeachers();
int rowsAffected = LitePal.deleteAll(Classroom.class, "id = ?", gameRoom.get_id() + "");
assertEquals(5, rowsAffected);
assertNull(getClassroom(gameRoom.get_id()));
assertNull(getStudent(jude.getId()));
assertNull(getStudent(rose.getId()));
assertNull(getTeacher(john.getId()));
assertNull(getTeacher(mike.getId()));
}
代码示例来源:origin: apache/hive
/**
* Testing getPartitionWithAuthInfo(String,String,List(String),String,List(String)) ->
* get_partition_with_auth(String,String,List(String),String,List(String)).
*/
@Test
public void testGetPartitionWithAuthInfoNoPrivilagesSet() throws Exception {
createTable3PartCols1Part(client);
Partition partition = client.getPartitionWithAuthInfo(DB_NAME, TABLE_NAME, Lists.newArrayList(
"1997", "05", "16"), "", Lists.newArrayList());
assertNotNull(partition);
assertNull(partition.getPrivileges());
}
代码示例来源:origin: apache/hive
@Test
public void testListPartitionsWithAuthNoPrivilegesSet() throws Exception {
List<List<String>> partValues = createTable4PartColsParts(client);
List<Partition> partitions = client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1,
"", Lists.newArrayList());
assertEquals(4, partitions.size());
assertPartitionsHaveCorrectValues(partitions, partValues);
partitions.forEach(partition -> assertNull(partition.getPrivileges()));
}
代码示例来源:origin: iSoron/uhabits
@Test
public void onDeleteHabits() throws Exception
{
Long id = habit1.getId();
assertNotNull(id);
assertNotNull(habitList.getById(id));
when(adapter.getSelected()).thenReturn(singletonList(habit1));
behavior.onDeleteHabits();
verify(screen).showDeleteConfirmationScreen(deleteCallback.capture());
deleteCallback.getValue().onConfirmed();
assertNull(habitList.getById(id));
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testInvalidateNewer()
{
Streak s = streaks.getNewestComputed();
assertThat(s.getEnd(), equalTo(today));
streaks.invalidateNewerThan(today.minus(8));
verify(listener).onModelChange();
s = streaks.getNewestComputed();
assertNull(s);
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testGetByTimestamp()
{
Repetition rep = repetitions.getByTimestamp(today);
assertNotNull(rep);
assertThat(rep.getTimestamp(), equalTo(today));
rep = repetitions.getByTimestamp(today.minus(2));
assertNull(rep);
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testGetOldest_withEmptyHabit()
{
Habit empty = fixtures.createEmptyHabit();
Repetition rep = empty.getRepetitions().getOldest();
assertNull(rep);
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testFindBeginning_withEmptyHistory()
{
Habit habit2 = fixtures.createEmptyHabit();
Timestamp beginning = habit2.getStreaks().findBeginning();
assertNull(beginning);
}
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testDeleteWithNoParameter() {
initJude();
jude.save();
int rowsAffected = jude.delete();
assertEquals(1, rowsAffected);
Student s = getStudent(jude.getId());
assertNull(s);
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldReturnNullGetLocalPartsWhenOriginIsRepo()
{
PipelineConfigs pipelineConfigs = createEmpty();
pipelineConfigs.setOrigins(new RepoConfigOrigin());
assertNull(pipelineConfigs.getLocal());
}
代码示例来源:origin: jankotek/mapdb
public void realRun() throws InterruptedException {
assertNull(q.poll());
threadsStarted.await();
assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
checkEmpty(q);
}});
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testDeleteById() {
initJude();
jude.save();
int rowsAffected = LitePal.delete(Student.class, jude.getId());
assertEquals(1, rowsAffected);
Student s = getStudent(jude.getId());
assertNull(s);
}
代码示例来源:origin: spring-projects/spring-framework
private void testDeferredResultSubscriber(Object returnValue, Class<?> asyncType,
ResolvableType elementType, Runnable produceTask, Object expected) throws Exception {
ResponseBodyEmitter emitter = handleValue(returnValue, asyncType, elementType);
assertNull(emitter);
assertTrue(this.servletRequest.isAsyncStarted());
assertFalse(WebAsyncUtils.getAsyncManager(this.webRequest).hasConcurrentResult());
produceTask.run();
assertTrue(WebAsyncUtils.getAsyncManager(this.webRequest).hasConcurrentResult());
assertEquals(expected, WebAsyncUtils.getAsyncManager(this.webRequest).getConcurrentResult());
resetRequest();
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testAdd()
{
RepetitionRecord record = getByTimestamp(today.plus(1));
assertNull(record);
Repetition rep = new Repetition(today.plus(1), CHECKED_EXPLICITLY);
habit.getRepetitions().add(rep);
record = getByTimestamp(today.plus(1));
assertNotNull(record);
assertThat(record.value, equalTo(CHECKED_EXPLICITLY));
}
代码示例来源:origin: LitePalFramework/LitePal
@Test
public void testEagerFindFirst() {
resetData();
Student s1 = LitePal.findFirst(Student.class);
assertNull(s1.getClassroom());
s1 = LitePal.findFirst(Student.class, true);
assertNotNull(s1);
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testRemove()
{
RepetitionRecord record = getByTimestamp(today);
assertNotNull(record);
Repetition rep = record.toRepetition();
repetitions.remove(rep);
record = getByTimestamp(today);
assertNull(record);
}
内容来源于网络,如有侵权,请联系作者删除!