本文整理汇总了Java中org.dmfs.jems.hamcrest.matchers.AbsentMatcher类的典型用法代码示例。如果您正苦于以下问题:Java AbsentMatcher类的具体用法?Java AbsentMatcher怎么用?Java AbsentMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbsentMatcher类属于org.dmfs.jems.hamcrest.matchers包,在下文中一共展示了AbsentMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBackReferences
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testBackReferences()
{
// Single matching
Predicate.Argument argumentA = when(mock(Predicate.Argument.class).backReference()).thenReturn(new Present<>(1)).getMock();
assertTrue(backReferences(isPresent(1)).matches(
when(mock(Predicate.class).arguments(any(TransactionContext.class))).thenReturn(new ArrayIterable<>(argumentA)).getMock()));
// Single non-matching
assertFalse(backReferences(isPresent(2)).matches(
when(mock(Predicate.class).arguments(any(TransactionContext.class))).thenReturn(new ArrayIterable<>(argumentA)).getMock()));
// Multiple
Predicate.Argument aB = when(mock(Predicate.Argument.class).backReference()).thenReturn(new Present<>(1)).getMock();
Predicate.Argument aC = when(mock(Predicate.Argument.class).backReference()).thenReturn(Absent.<Integer>absent()).getMock();
Predicate.Argument aD = when(mock(Predicate.Argument.class).backReference()).thenReturn(new Present<>(3)).getMock();
assertTrue(backReferences(isPresent(1), AbsentMatcher.<Integer>isAbsent(), isPresent(3)).matches(
when(mock(Predicate.class).arguments(any(TransactionContext.class))).thenReturn(new ArrayIterable<>(aB, aC, aD)).getMock()));
// Single with TC
TransactionContext dummyTc = dummy(TransactionContext.class);
Predicate.Argument argumentE = when(mock(Predicate.Argument.class).backReference()).thenReturn(new Present<>(1)).getMock();
assertTrue(backReferences(dummyTc, isPresent(1)).matches(
when(mock(Predicate.class).arguments(dummyTc)).thenReturn(new ArrayIterable<>(argumentE)).getMock()));
}
示例2: testSelection
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testSelection() throws Exception
{
TransactionContext mockTc = failingMock(TransactionContext.class);
SoftRowReference<CalendarContract.Calendars> dummyReference = dummy(SoftRowReference.class);
RowSnapshot<CalendarContract.Calendars> mockCalendarRow = failingMock(RowSnapshot.class);
doReturn(dummyReference).when(mockCalendarRow).reference();
doReturn(new BackReference<>(dummy(Uri.class), 12)).when(mockTc).resolved(dummyReference);
assertThat(new CalendarScoped(mockCalendarRow, new EqArg("x", "y")),
predicateWith(
selection(mockTc, "( x = ? ) and ( calendar_id = ? )"),
argumentValues(mockTc, "y", "-1"),
backReferences(mockTc, AbsentMatcher.<Integer>isAbsent(), isPresent(12))
));
}
示例3: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference()
{
assertThat(new BulkAssert<Object>(dummy(Table.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new BulkAssert<Object>(dummy(Table.class), dummy(Predicate.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new BulkAssert<Object>(dummy(Table.class), dummy(RowData.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new BulkAssert<Object>(dummy(Table.class), dummy(RowData.class), dummy(Predicate.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例4: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference()
{
assertThat(new BulkUpdate<Object>(dummy(Table.class), dummy(RowData.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new BulkUpdate<Object>(dummy(Table.class), dummy(RowData.class), dummy(Predicate.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例5: testVirtualReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testVirtualReference() throws Exception
{
RowSnapshot<Object> dummyRowSnapshot = dummy(RowSnapshot.class);
assertThat(new Delete<>(dummyRowSnapshot).reference(), AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例6: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference() throws Exception
{
Table<Object> mockTable = failingMock(Table.class);
assertThat(new Insert<Object>(mockTable).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new Insert<Object>(mockTable, dummy(RowData.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例7: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference()
{
assertThat(new BulkDelete<Object>(dummy(Table.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
assertThat(new BulkDelete<Object>(dummy(Table.class), dummy(Predicate.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例8: test
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void test()
{
Object mockValue = failingMock(Object.class);
doReturn("val").when(mockValue).toString();
Predicate.Argument underTest = new ValueArgument(mockValue);
assertThat(underTest.value(), is("val"));
assertThat(underTest.backReference(), AbsentMatcher.<Integer>isAbsent());
}
示例9: test_whenColumnValueIsAbsent_shouldBeAbsent
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void test_whenColumnValueIsAbsent_shouldBeAbsent()
{
RowDataSnapshot<Tasks> mockData = failingMock(RowDataSnapshot.class);
doReturn(absent()).when(mockData).data(eq(Tasks.DTSTART), any());
assertThat(new TaskDateTime(Tasks.DTSTART, mockData), AbsentMatcher.<DateTime>isAbsent());
}
示例10: test_whenDueIsAbsent_startIsAbsent_durationIsAbsent_shouldBeAbsent
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void test_whenDueIsAbsent_startIsAbsent_durationIsAbsent_shouldBeAbsent()
{
RowDataSnapshot<Tasks> mockData = failingMock(RowDataSnapshot.class);
doReturn(absent()).when(mockData).data(eq(Tasks.DUE), any());
doReturn(absent()).when(mockData).data(eq(Tasks.DTSTART), any());
doReturn(absent()).when(mockData).data(eq(Tasks.DURATION), any());
doReturn(new Present<>(false)).when(mockData).data(eq(Tasks.IS_ALLDAY), any());
doReturn(new Present<>(TimeZone.getTimeZone("UTC"))).when(mockData).data(eq(Tasks.TZ), any());
assertThat(new EffectiveDueDate(mockData), AbsentMatcher.<DateTime>isAbsent());
}
示例11: test_whenDueIsAbsent_startIsPresent_durationIsAbsent_shouldBeAbsent
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void test_whenDueIsAbsent_startIsPresent_durationIsAbsent_shouldBeAbsent()
{
RowDataSnapshot<Tasks> mockData = failingMock(RowDataSnapshot.class);
doReturn(absent()).when(mockData).data(eq(Tasks.DUE), any());
doReturn(new Present<>(234234)).when(mockData).data(eq(Tasks.DTSTART), any());
doReturn(absent()).when(mockData).data(eq(Tasks.DURATION), any());
doReturn(new Present<>(false)).when(mockData).data(eq(Tasks.IS_ALLDAY), any());
doReturn(new Present<>(TimeZone.getTimeZone("UTC"))).when(mockData).data(eq(Tasks.TZ), any());
assertThat(new EffectiveDueDate(mockData), AbsentMatcher.<DateTime>isAbsent());
}
示例12: test_whenDueIsAbsent_startIsAbsent_durationIsPresent_shouldBeAbsent
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void test_whenDueIsAbsent_startIsAbsent_durationIsPresent_shouldBeAbsent()
{
RowDataSnapshot<Tasks> mockData = failingMock(RowDataSnapshot.class);
doReturn(absent()).when(mockData).data(eq(Tasks.DUE), any());
doReturn(absent()).when(mockData).data(eq(Tasks.DTSTART), any());
doReturn(new Present<>(Duration.parse("P7W"))).when(mockData).data(eq(Tasks.DURATION), any());
doReturn(new Present<>(false)).when(mockData).data(eq(Tasks.IS_ALLDAY), any());
doReturn(new Present<>(TimeZone.getTimeZone("UTC"))).when(mockData).data(eq(Tasks.TZ), any());
assertThat(new EffectiveDueDate(mockData), AbsentMatcher.<DateTime>isAbsent());
}
示例13: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference() throws Exception
{
assertThat(new Assert<Object>(dummy(RowSnapshot.class), dummy(RowData.class)).reference(),
AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例14: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference() throws Exception
{
assertThat(new RawDelete<>(dummy(Uri.class)).reference(), AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}
示例15: testReference
import org.dmfs.jems.hamcrest.matchers.AbsentMatcher; //导入依赖的package包/类
@Test
public void testReference() throws Exception
{
assertThat(new RawAssert<>(dummy(Uri.class)).reference(), AbsentMatcher.<SoftRowReference<Object>>isAbsent());
}