当前位置: 首页>>代码示例>>Java>>正文


Java AbsentMatcher类代码示例

本文整理汇总了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()));
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:25,代码来源:PredicateMatcherTest.java

示例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))
            ));
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:18,代码来源:CalendarScopedPredicateTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:16,代码来源:BulkAssertTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:10,代码来源:BulkUpdateTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:8,代码来源:DeleteTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:12,代码来源:InsertTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:10,代码来源:BulkDeleteTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:11,代码来源:ValueArgumentTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:opentasks,代码行数:9,代码来源:TaskDateTimeTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:opentasks,代码行数:13,代码来源:EffectiveDueDateTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:opentasks,代码行数:13,代码来源:EffectiveDueDateTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:opentasks,代码行数:13,代码来源:EffectiveDueDateTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:7,代码来源:AssertTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:6,代码来源:RawDeleteTest.java

示例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());
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:6,代码来源:RawAssertTest.java


注:本文中的org.dmfs.jems.hamcrest.matchers.AbsentMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。