本文整理汇总了Java中org.mockito.internal.matchers.StartsWith类的典型用法代码示例。如果您正苦于以下问题:Java StartsWith类的具体用法?Java StartsWith怎么用?Java StartsWith使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StartsWith类属于org.mockito.internal.matchers包,在下文中一共展示了StartsWith类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
protected void setup() throws Exception {
mockApp = mock(App.class);
Field f = App.class.getDeclaredField("INST");
f.setAccessible(true);
f.set(null, mockApp);
mockJobManager = mock(AppJobManager.class);
mockEventBus = mock(EventBus.class);
when(mockApp.jobManager()).thenReturn(mockJobManager);
when(mockApp.eventBus()).thenReturn(mockEventBus);
mockAppConfig = mock(AppConfig.class);
when(mockAppConfig.possibleControllerClass(argThat(new StartsWith("testapp.controller.")))).thenReturn(true);
mockActionContext = mock(ActionContext.class);
when(mockActionContext.app()).thenReturn(mockApp);
when(mockActionContext.config()).thenReturn(mockAppConfig);
mockRouter = mock(Router.class);
when(mockApp.config()).thenReturn(mockAppConfig);
when(mockApp.router()).thenReturn(mockRouter);
when(mockApp.getInstance(any(Class.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
return $.newInstance((Class)args[0]);
}
});
mockReq = mock(H.Request.class);
mockResp = mock(H.Response.class);
}
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:28,代码来源:AAATestBase.java
示例2: setup
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
protected void setup() throws Exception {
initActMetricPlugin();
mockApp = mock(App.class);
Field f = App.class.getDeclaredField("INST");
f.setAccessible(true);
f.set(null, mockApp);
mockSingletonRegistry = mock(SingletonRegistry.class);
//when(mockApp.singletonRegistry()).thenReturn(mockSingletonRegistry);
mockJobManager = mock(JobManager.class);
when(mockApp.jobManager()).thenReturn(mockJobManager);
mockEventBus = mock(EventBus.class);
when(mockApp.eventBus()).thenReturn(mockEventBus);
mockAppConfig = mock(AppConfig.class);
when(mockAppConfig.possibleControllerClass(argThat(new StartsWith("testapp.controller.")))).thenReturn(true);
mockActionContext = mock(ActionContext.class);
when(mockActionContext.app()).thenReturn(mockApp);
when(mockActionContext.config()).thenReturn(mockAppConfig);
mockRouter = mock(Router.class);
when(mockApp.config()).thenReturn(mockAppConfig);
when(mockApp.router()).thenReturn(mockRouter);
when(mockApp.router(Matchers.same(""))).thenReturn(mockRouter);
when(mockApp.getInstance(any(Class.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
Class<?> cls = (Class) args[0];
if (SessionManager.class == cls) {
return new SessionManager(mockAppConfig);
}
return $.newInstance((Class)args[0]);
}
});
mockReq = mock(H.Request.class);
mockResp = mock(ActResponse.class);
when(mockReq.method()).thenReturn(H.Method.GET);
}
开发者ID:actframework,项目名称:actframework,代码行数:37,代码来源:ActTestBase.java
示例3: shouldExportContentsAsFile
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test(dataProvider = "prefs")
public void shouldExportContentsAsFile(String p) throws Exception {
mvc.perform(get(p).param("export", "file"))
.andExpect(status().is(200))
.andExpect(content().contentType(APPLICATION_XML))
.andExpect(header().string("Content-Disposition", new StartsWith("attachment;")));
}
开发者ID:adobe-research,项目名称:cross-preferences,代码行数:8,代码来源:PrefsControllerTest.java
示例4: masterpage_is_served_without_trailing_slash
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
@RunAsClient
public void masterpage_is_served_without_trailing_slash(@ArquillianResource URL baseUrl) {
String url = baseUrl.toString();
url = url.substring(0, url.length() - 1);
given()
.auth().basic("ThePoltergeist", "bouh")
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.expect()
.statusCode(200)
.header(HttpHeaders.CONTENT_TYPE, new StartsWith(MediaType.TEXT_HTML))
.when()
.get(url);
}
开发者ID:seedstack,项目名称:w20-bridge-addon,代码行数:15,代码来源:WithPrefixesIT.java
示例5: masterpage_is_served_with_trailing_slash
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
@RunAsClient
public void masterpage_is_served_with_trailing_slash(@ArquillianResource URL baseUrl) {
given()
.auth().basic("ThePoltergeist", "bouh")
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.expect()
.statusCode(200)
.header(HttpHeaders.CONTENT_TYPE, new StartsWith(MediaType.TEXT_HTML))
.when()
.get(baseUrl.toString());
}
开发者ID:seedstack,项目名称:w20-bridge-addon,代码行数:13,代码来源:WithPrefixesIT.java
示例6: json_home_is_served_on_rest_root
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
@RunAsClient
public void json_home_is_served_on_rest_root(@ArquillianResource URL baseUrl) {
given()
.auth().basic("ThePoltergeist", "bouh")
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
.expect()
.statusCode(200)
.header(HttpHeaders.CONTENT_TYPE, new StartsWith(MediaType.APPLICATION_JSON))
.when()
.get(baseUrl.toString() + "rest/");
}
开发者ID:seedstack,项目名称:w20-bridge-addon,代码行数:13,代码来源:WithPrefixesIT.java
示例7: masterpage_is_correctly_served
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
@RunAsClient
public void masterpage_is_correctly_served(@ArquillianResource URL baseUrl) {
given()
.auth().basic("ThePoltergeist", "bouh")
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.expect()
.statusCode(200)
.header(HttpHeaders.CONTENT_TYPE, new StartsWith(MediaType.TEXT_HTML))
.when()
.get(baseUrl.toString());
}
开发者ID:seedstack,项目名称:w20-bridge-addon,代码行数:13,代码来源:W20BridgeIT.java
示例8: redirection_to_masterpage_is_working
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
@RunAsClient
public void redirection_to_masterpage_is_working(@ArquillianResource URL baseUrl) {
given()
.auth().basic("ThePoltergeist", "bouh")
.header(HttpHeaders.ACCEPT, MediaType.TEXT_HTML)
.expect()
.statusCode(200)
.header(HttpHeaders.CONTENT_TYPE, new StartsWith(MediaType.TEXT_HTML))
.when()
.get(baseUrl.toString() + "subpage");
}
开发者ID:seedstack,项目名称:w20-bridge-addon,代码行数:13,代码来源:W20BridgeIT.java
示例9: headerTest
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
public void headerTest() throws JMSException, UnknownHostException {
TextMessage msg = Mockito.mock(TextMessage.class);
Mockito.when(session.createTextMessage(Matchers.anyString())).thenReturn(msg);
EventServiceBindingDescriptor eventServiceBindingDescriptor = Mockito.mock(EventServiceBindingDescriptor.class);
Mockito.when(eventServiceBindingDescriptor.getServiceVersion()).thenReturn(new ServiceVersion(1, 0));
cut.marshallEvent(eventServiceBindingDescriptor, new ExpectedEvent("bob", "100 chancellors"), session);
String thisHost = InetAddress.getLocalHost().getCanonicalHostName();
Mockito.verify(msg).setStringProperty(Matchers.eq(JMSPropertyConstants.MESSAGE_ID_FIELD_NAME), Matchers.anyString());
Mockito.verify(msg).setStringProperty(Matchers.eq(JMSPropertyConstants.MESSAGE_ROUTING_FIELD_NAME), Matchers.argThat(new StartsWith(thisHost)));
}
开发者ID:betfair,项目名称:cougar,代码行数:16,代码来源:JMSEventMarshallerTest.java
示例10: testStopTaskInNonStopeableState
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
private void testStopTaskInNonStopeableState(PipelineExecutorTask.Status notStopeableStatus) throws PipelineExecutorException {
PipelineExecutorTaskImpl task = mock(PipelineExecutorTaskImpl.class);
when(task.getId()).thenReturn(TASK_ID);
when(task.getPipelineStatus()).thenReturn(notStopeableStatus);
PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class);
when(taskEntry.isAsync()).thenReturn(true);
when(taskEntry.getTask()).thenReturn(task);
taskManager.currentTasks.put(TASK_ID,
taskEntry);
taskManager.init();
expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + notStopeableStatus.name() +
" can not be stopped. Stop operation is available for the following status set:"));
taskManager.stop(TASK_ID);
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:16,代码来源:PipelineExecutorTaskManagerImplExecutionTest.java
示例11: testDeleteActiveTask
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
public void testDeleteActiveTask() throws Exception {
PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class);
taskManager.currentTasks.put(TASK_ID,
taskEntry);
expectedException.expectMessage(new StartsWith("An active PipelineExecutorTask was found for taskId: " + TASK_ID));
taskManager.delete(TASK_ID);
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:PipelineExecutorTaskManagerImplExecutionTest.java
示例12: testDeleteTaskInNonStopeableState
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
private void testDeleteTaskInNonStopeableState(PipelineExecutorTask.Status nonStopeableStatus) throws Exception {
PipelineExecutorTask task = mock(PipelineExecutorTask.class);
when(task.getPipelineStatus()).thenReturn(nonStopeableStatus);
PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class);
when(trace.getTask()).thenReturn(task);
when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace);
expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: "
+ nonStopeableStatus + " can not" +
" be deleted. Delete operation is available for the following status set:"));
taskManager.delete(TASK_ID);
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:13,代码来源:PipelineExecutorTaskManagerImplExecutionTest.java
示例13: test_index
import org.mockito.internal.matchers.StartsWith; //导入依赖的package包/类
@Test
public void test_index() throws Exception {
mvc.perform(get("/")).andExpect(status().isOk()).andExpect(
content().string(new Contains("<label>Say what ever:</label>"))).andExpect(
content().string(new StartsWith("<!DOCTYPE html>")));
}
开发者ID:cnagel,项目名称:spring-scalate,代码行数:7,代码来源:HomeControllerTests.java
注:本文中的org.mockito.internal.matchers.StartsWith类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论