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


Java GreaterThan类代码示例

本文整理汇总了Java中org.mockito.internal.matchers.GreaterThan的典型用法代码示例。如果您正苦于以下问题:Java GreaterThan类的具体用法?Java GreaterThan怎么用?Java GreaterThan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GreaterThan类属于org.mockito.internal.matchers包,在下文中一共展示了GreaterThan类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: temporary_failing_joinpoint_should_wait_before_retry

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void temporary_failing_joinpoint_should_wait_before_retry() throws Throwable {
    // Given
    Object value = new Object();
    final long retryDelay = 250;
    ProceedingJoinPoint pjp = createProceedingJoinPoint("foo", "com.sample.foo", Object.class);
    when(pjp.proceed()).then(answerAfterFailing(value, new RuntimeException()));
    RetryOnFailure retryOnFailure = createRetryOnFailure(3, retryDelay);

    // When
    long start = System.currentTimeMillis();
    Object result = aspect.proceedWithRetryOnFailure(pjp, retryOnFailure);
    long end = System.currentTimeMillis();

    // Then
    verify(pjp, times(2)).proceed();
    assertThat(result, is(value));
    assertThat((end - start), new GreaterThan<>(retryDelay));
}
 
开发者ID:deezer,项目名称:Counsel,代码行数:20,代码来源:RetryAspectTest.java

示例2: testFilterLike

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void testFilterLike() throws Exception
{
    MockHttpSession session = getSession( "F_DATAELEMENT_PUBLIC_ADD" );
    DataElement de = createDataElement( 'A' );
    manager.save( de );

    List<FieldDescriptor> fieldDescriptors = new ArrayList<>();
    fieldDescriptors.addAll( ResponseDocumentation.pager() );
    fieldDescriptors.add( fieldWithPath( "dataElements" ).description( "Data elements" ) );

    mvc.perform( get( "/dataElements?filter=name:like:DataElementA" )
        .session( session )
        .contentType( TestUtils.APPLICATION_JSON_UTF8 ) )
        .andExpect( jsonPath( "$.pager.total", new GreaterThan<Integer>( 0 ) ) )
        .andDo( documentPrettyPrint( "data-elements/filter",
            responseFields( fieldDescriptors.toArray( new FieldDescriptor[fieldDescriptors.size()] ) ) ) );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:19,代码来源:DataElementControllerDocumentation.java

示例3: makeMockFolderWithMessages

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
private JavaxMailFolder makeMockFolderWithMessages(int numMessages,
    JavaxMailFolder... folders) {
  JavaxMailFolder javaxMailFolder = mock(JavaxMailFolder.class);

  when(javaxMailFolder.getType())
      .thenReturn(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);

  when(javaxMailFolder.getMessageCount())
      .thenReturn(numMessages);
  when(javaxMailFolder.getMessage(Matchers.intThat(new LessOrEqual<>(numMessages))))
      .thenReturn(mock(JavaxMailMessage.class));
  when(javaxMailFolder.getMessage(Matchers.intThat(new GreaterThan<>(numMessages))))
      .thenThrow(new RuntimeMessagingException(
          new MessagingException("crap")));

  when(javaxMailFolder.list()).thenReturn(folders);
  return javaxMailFolder;
}
 
开发者ID:google,项目名称:mail-importer,代码行数:19,代码来源:JavaxMailStorageTest.java

示例4: addTest

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void addTest() {
    final User user = User.builder()
        .account("easytoolsoft_test")
        .name("easytoolsoft.com")
        .password("easytoolsoft_test")
        .email("[email protected]")
        .roles("1")
        .salt("abcdefg")
        .status((byte)0)
        .telephone("13800000000")
        .gmtCreated(new Date())
        .comment("")
        .build();
    this.userService.add(user);
    Assert.assertThat(user.getId(), new GreaterThan<>(0));
}
 
开发者ID:xianrendzw,项目名称:EasyReport,代码行数:18,代码来源:UserServiceTest.java

示例5: addTest

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void addTest() {
    final User user = User.builder()
        .account("easytoolsoft_test")
        .name("easytoolsoft.com")
        .password("easytoolsoft_test")
        .email("[email protected]")
        .roles("1")
        .salt("abcdefg")
        .status((byte)0)
        .telephone("13800000000")
        .gmtCreated(new Date())
        .comment("")
        .build();
    this.userService.add(user, new ShardTable("user"));
    Assert.assertThat(user.getId(), new GreaterThan<>(0));
}
 
开发者ID:xianrendzw,项目名称:EasyReport,代码行数:18,代码来源:UserServiceTest.java

示例6: testFilteriLikeOk

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void testFilteriLikeOk() throws Exception
{
    MockHttpSession session = getSession( "F_DATAELEMENT_PUBLIC_ADD" );
    DataElement de = createDataElement( 'A' );
    manager.save( de );

    mvc.perform( get( "/dataElements?filter=name:ilike:DataElementA" )
        .session( session )
        .contentType( TestUtils.APPLICATION_JSON_UTF8 ) )
        .andExpect( jsonPath( "$.pager.total", new GreaterThan<Integer>( 0 ) ) );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:13,代码来源:DataElementControllerDocumentation.java

示例7: testFilterEqualOk

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void testFilterEqualOk() throws Exception
{
    MockHttpSession session = getSession( "F_DATAELEMENT_PUBLIC_ADD" );
    DataElement de = createDataElement( 'A' );
    manager.save( de );

    mvc.perform( get( "/dataElements?filter=name:eq:DataElementA" )
        .session( session )
        .contentType( TestUtils.APPLICATION_JSON_UTF8 ) )
        .andExpect( jsonPath( "$.pager.total", new GreaterThan<Integer>( 0 ) ) );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:13,代码来源:DataElementControllerDocumentation.java

示例8: testCreateOrganization

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
@Test
public void testCreateOrganization() throws Exception {
	
	// 1. Only required input field is name
	CreateOrganizationDTO organizationDto = new CreateOrganizationDTO();
	organizationDto.setName("Test Organization 1"); 
	    	 
	mockMvc.perform(post(URI_ADD_ORGANIZATION)
			.content(asJsonString(organizationDto))
			.contentType(MediaType.APPLICATION_JSON)
			.accept(MediaType.APPLICATION_JSON))
		.andExpect(status().isOk())
		.andExpect(jsonPath("$.organization.id", new GreaterThan<Integer>(0))) 
		.andExpect(jsonPath("$.organization.name",is("Test Organization 1"))) 
		.andExpect(jsonPath("$.organization.category",is("N"))) // default category is N
		.andExpect(jsonPath("$.organization.status",is("A"))); // default status is A
	
	// 2. Tests all the fields
	organizationDto = new CreateOrganizationDTO();
	organizationDto.setName("Test Organization 2"); 
	organizationDto.setWebsiteUrl("websiteUrl");
	organizationDto.setDescription("description");
	organizationDto.setAddress1("address1");
	organizationDto.setAddress2("address2");
	organizationDto.setCity("city");
	organizationDto.setState("state");
	organizationDto.setZip("zip");
	organizationDto.setCountry("country");
	organizationDto.setContactName("contactName");
	organizationDto.setContactPhone("contactPhone");
	organizationDto.setContactEmail("contactEmail");
	organizationDto.setCategory("O");
	
	mockMvc.perform(post(URI_ADD_ORGANIZATION)
			.content(asJsonString(organizationDto))
			.contentType(MediaType.APPLICATION_JSON)
			.accept(MediaType.APPLICATION_JSON))
		.andExpect(status().isOk())
		.andExpect(jsonPath("$.organization.id", new GreaterThan<Integer>(0))) 
		.andExpect(jsonPath("$.organization.name",is("Test Organization 2"))) 
		.andExpect(jsonPath("$.organization.websiteUrl",is("websiteUrl"))) 
		.andExpect(jsonPath("$.organization.description",is("description"))) 
		.andExpect(jsonPath("$.organization.address1",is("address1"))) 
		.andExpect(jsonPath("$.organization.address2",is("address2"))) 
		.andExpect(jsonPath("$.organization.city",is("city"))) 
		.andExpect(jsonPath("$.organization.state",is("state"))) 
		.andExpect(jsonPath("$.organization.zip",is("zip"))) 
		.andExpect(jsonPath("$.organization.country",is("country"))) 
		.andExpect(jsonPath("$.organization.contactName",is("contactName"))) 
		.andExpect(jsonPath("$.organization.contactPhone",is("contactPhone"))) 
		.andExpect(jsonPath("$.organization.contactEmail",is("contactEmail"))) 
		.andExpect(jsonPath("$.organization.category",is("O")))
		.andExpect(jsonPath("$.organization.status",is("A")))
.andExpect(jsonPath("$.organization.createdTime", is(nullValue())));
}
 
开发者ID:Code4SocialGood,项目名称:c4sg-services,代码行数:56,代码来源:OrganizationControllerTest.java

示例9: assertCounterGt

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
/**
 * Assert that a long counter metric is greater than a value
 * @param name  of the metric
 * @param greater value of the metric should be greater than this
 * @param rb  the record builder mock used to getMetrics
 */
public static void assertCounterGt(String name, long greater,
                                   MetricsRecordBuilder rb) {
  Assert.assertThat("Bad value for metric " + name, getLongCounter(name, rb),
      new GreaterThan<Long>(greater));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:12,代码来源:MetricsAsserts.java

示例10: assertGaugeGt

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
/**
 * Assert that a double gauge metric is greater than a value
 * @param name  of the metric
 * @param greater value of the metric should be greater than this
 * @param rb  the record builder mock used to getMetrics
 */
public static void assertGaugeGt(String name, double greater,
                                 MetricsRecordBuilder rb) {
  Assert.assertThat("Bad value for metric " + name, getDoubleGauge(name, rb),
      new GreaterThan<Double>(greater));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:12,代码来源:MetricsAsserts.java

示例11: gt

import org.mockito.internal.matchers.GreaterThan; //导入依赖的package包/类
/**
 * comparable argument greater than the given value.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param value
 *            the given value.
 * @return <code>null</code>.
 */
public static <T extends Comparable<T>> T gt(Comparable<T> value) {
    return reportMatcher(new GreaterThan<T>(value)).<T>returnNull();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:AdditionalMatchers.java


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