@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));
}
java类org.mockito.internal.matchers.GreaterThan的实例源码
RetryAspectTest.java 文件源码
项目:Counsel
阅读 45
收藏 0
点赞 0
评论 0
DataElementControllerDocumentation.java 文件源码
项目:dhis2-core
阅读 42
收藏 0
点赞 0
评论 0
@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()] ) ) ) );
}
JavaxMailStorageTest.java 文件源码
项目:mail-importer
阅读 32
收藏 0
点赞 0
评论 0
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;
}
DataElementControllerDocumentation.java 文件源码
项目:dhis2-core
阅读 35
收藏 0
点赞 0
评论 0
@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 ) ) );
}
DataElementControllerDocumentation.java 文件源码
项目:dhis2-core
阅读 36
收藏 0
点赞 0
评论 0
@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 ) ) );
}
OrganizationControllerTest.java 文件源码
项目:c4sg-services
阅读 40
收藏 0
点赞 0
评论 0
@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())));
}
MetricsAsserts.java 文件源码
项目:hadoop-oss
阅读 41
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop-oss
阅读 29
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop
阅读 32
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:aliyun-oss-hadoop-fs
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:aliyun-oss-hadoop-fs
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:big-c
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:big-c
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop-2.6.0-cdh5.4.3
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop-2.6.0-cdh5.4.3
阅读 49
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop-plus
阅读 35
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hadoop-plus
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hops
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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));
}
MetricsAsserts.java 文件源码
项目:hops
阅读 41
收藏 0
点赞 0
评论 0
/**
* 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));
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 33
收藏 0
点赞 0
评论 0
/**
* byte argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static byte gt(byte value) {
return reportMatcher(new GreaterThan<Byte>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 42
收藏 0
点赞 0
评论 0
/**
* double argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static double gt(double value) {
return reportMatcher(new GreaterThan<Double>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 32
收藏 0
点赞 0
评论 0
/**
* float argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static float gt(float value) {
return reportMatcher(new GreaterThan<Float>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 38
收藏 0
点赞 0
评论 0
/**
* int argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static int gt(int value) {
return reportMatcher(new GreaterThan<Integer>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 37
收藏 0
点赞 0
评论 0
/**
* long argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static long gt(long value) {
return reportMatcher(new GreaterThan<Long>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 37
收藏 0
点赞 0
评论 0
/**
* short argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static short gt(short value) {
return reportMatcher(new GreaterThan<Short>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 38
收藏 0
点赞 0
评论 0
/**
* byte argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static byte gt(byte value) {
return reportMatcher(new GreaterThan<Byte>(value)).returnZero();
}
AdditionalMatchers.java 文件源码
项目:astor
阅读 36
收藏 0
点赞 0
评论 0
/**
* double argument greater than the given value.
* <p>
* See examples in javadoc for {@link AdditionalMatchers} class
*
* @param value
* the given value.
* @return <code>0</code>.
*/
public static double gt(double value) {
return reportMatcher(new GreaterThan<Double>(value)).returnZero();
}