本文整理了Java中org.hamcrest.core.Is.isA()
方法的一些代码示例,展示了Is.isA()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Is.isA()
方法的具体详情如下:
包路径:org.hamcrest.core.Is
类名称:Is
方法名:isA
[英]A shortcut to the frequently used is(instanceOf(SomeClass.class))
.
For example:
assertThat(cheese, isA(Cheddar.class))
instead of:
assertThat(cheese, is(instanceOf(Cheddar.class)))
[中]常用is(instanceOf(SomeClass.class))
的快捷方式。
例如:
assertThat(cheese, isA(Cheddar.class))
而不是:
assertThat(cheese, is(instanceOf(Cheddar.class)))
代码示例来源:origin: google/j2objc
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* <p/>
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.<T>isA(type);
}
代码示例来源:origin: org.hamcrest/hamcrest-all
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* <p/>
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.<T>isA(type);
}
代码示例来源:origin: org.hamcrest/hamcrest-all
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* <p/>
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.<T>isA(type);
}
代码示例来源:origin: hamcrest/JavaHamcrest
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<?> type) {
return org.hamcrest.core.Is.isA(type);
}
代码示例来源:origin: hamcrest/JavaHamcrest
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.isA(type);
}
代码示例来源:origin: spring-projects/spring-framework
@Override
@Test
public void jmsHandlerMethodFactoryConfiguration() throws JMSException {
ApplicationContext context = new ClassPathXmlApplicationContext(
"annotation-driven-custom-handler-method-factory.xml", getClass());
thrown.expect(ListenerExecutionFailedException.class);
thrown.expectCause(Is.<MethodArgumentNotValidException>isA(MethodArgumentNotValidException.class));
testJmsHandlerMethodFactoryConfiguration(context);
}
代码示例来源:origin: spring-projects/spring-framework
@Override
@Test
public void jmsHandlerMethodFactoryConfiguration() throws JMSException {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
EnableJmsHandlerMethodFactoryConfig.class, ValidationBean.class);
thrown.expect(ListenerExecutionFailedException.class);
thrown.expectCause(Is.<MethodArgumentNotValidException>isA(MethodArgumentNotValidException.class));
testJmsHandlerMethodFactoryConfiguration(context);
}
代码示例来源:origin: hamcrest/JavaHamcrest
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test public void
providesConvenientShortcutForIsInstanceOf() {
final Matcher matcher = isA(Number.class);
assertMatches(matcher, 1);
assertDoesNotMatch(matcher, new Object());
assertDoesNotMatch(matcher, null);
}
}
代码示例来源:origin: org.hamcrest/java-hamcrest
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.<T>isA(type);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* <p/>
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.<T>isA(type);
}
代码示例来源:origin: org.hamcrest/java-hamcrest
/**
* A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>.
* For example:
* <pre>assertThat(cheese, isA(Cheddar.class))</pre>
* instead of:
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
*/
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
return org.hamcrest.core.Is.isA(type);
}
代码示例来源:origin: apache/hbase
/**
* Ignore this test, see HBASE-21421
*/
@Test
@Ignore
public void testReportRSWithWrongRegion() throws Exception {
final TableName tableName = TableName.valueOf(this.name.getMethodName());
List<HRegionInfo> tableRegions = createTable(tableName);
final ServerName sn = ServerName.parseVersionedServerName(
ServerName.valueOf("1.example.org", 1, System.currentTimeMillis()).getVersionedBytes());
// make fake request with a region assigned to different RS
RegionServerStatusProtos.RegionServerReportRequest.Builder request =
makeRSReportRequestWithRegions(sn, tableRegions.get(1));
// sending fake request to master
// TODO: replace YouAreDeadException with appropriate exception as and when necessary
exception.expect(ServiceException.class);
exception.expectCause(isA(YouAreDeadException.class));
RegionServerStatusProtos.RegionServerReportResponse response =
master.getMasterRpcServices().regionServerReport(null, request.build());
}
代码示例来源:origin: palantir/atlasdb
@Test public void
shouldRethrowExceptions() {
RuntimeException response = allocationFailures.responseTo(FAILURE);
assertThat(response.getCause(), is(FAILURE));
assertThat(response, isA(RuntimeException.class));
assertThat(response.getMessage(), containsString("Could not allocate more timestamps"));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldConfigureToStart() {
// given
processEngineConfiguration
.setHistoryRemovalTimeProvider(mock(HistoryRemovalTimeProvider.class))
.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_START);
// when
processEngineConfiguration.initHistoryRemovalTime();
// then
assertThat(processEngineConfiguration.getHistoryRemovalTimeStrategy(), is(HISTORY_REMOVAL_TIME_STRATEGY_START));
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldConfigureToEnd() {
// given
processEngineConfiguration
.setHistoryRemovalTimeProvider(mock(HistoryRemovalTimeProvider.class))
.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END);
// when
processEngineConfiguration.initHistoryRemovalTime();
// then
assertThat(processEngineConfiguration.getHistoryRemovalTimeStrategy(), is(HISTORY_REMOVAL_TIME_STRATEGY_END));
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldConfigureToNone() {
// given
processEngineConfiguration
.setHistoryRemovalTimeProvider(mock(HistoryRemovalTimeProvider.class))
.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_NONE);
// when
processEngineConfiguration.initHistoryRemovalTime();
// then
assertThat(processEngineConfiguration.getHistoryRemovalTimeStrategy(), is(HISTORY_REMOVAL_TIME_STRATEGY_NONE));
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldAutomaticallyConfigure() {
// given
processEngineConfiguration
.setHistoryRemovalTimeProvider(null)
.setHistoryRemovalTimeStrategy(null);
// when
processEngineConfiguration.initHistoryRemovalTime();
// then
assertThat(processEngineConfiguration.getHistoryRemovalTimeStrategy(), is(HISTORY_REMOVAL_TIME_STRATEGY_END));
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldConfigureWithoutProvider() {
// given
processEngineConfiguration
.setHistoryRemovalTimeProvider(null)
.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END);
// when
processEngineConfiguration.initHistoryRemovalTime();
// then
assertThat(processEngineConfiguration.getHistoryRemovalTimeStrategy(), is(HISTORY_REMOVAL_TIME_STRATEGY_END));
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldConfigureWithNotExistentStrategy() {
// given
processEngineConfiguration.setHistoryRemovalTimeStrategy("notExistentStrategy");
// then
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("history removal time strategy must be set to 'start', 'end' or 'none'");
// when
processEngineConfiguration.initHistoryRemovalTime();
// assume
assertThat(processEngineConfiguration.getHistoryRemovalTimeProvider(), isA(HistoryRemovalTimeProvider.class));
}
代码示例来源:origin: mulesoft/mule
@Test
public void resolvePollingSourceMetadata() {
MetadataResult<ComponentMetadataDescriptor<SourceModel>> sourceMetadata =
metadataService.getSourceMetadata(Location.builder().globalName("polling-source").addSourcePart().build());
assertThat(sourceMetadata.get().getModel().getOutput().getType(), (Matcher) isA(StringType.class));
}
}
内容来源于网络,如有侵权,请联系作者删除!