嘲笑Spring Boot(Mocking Spring Boot)
我想在Spring Boot(Spring Boot 1.4.2.RELEASE)中实现测试,所以我正在检查这个例子
https://spring.io/blog/2016/04/15/testing-improvements-in-spring-boot-1-4
但无法在此包中的任何位置找到给定的方法
import static org.mockito.Mockito。*
I want to implements tests in Spring Boot (Spring Boot 1.4.2.RELEASE), so I am checking this example
https://spring.io/blog/2016/04/15/testing-improvements-in-spring-boot-1-4
but not able to find the given method anywhere in this package
import static org.mockito.Mockito.*
原文:https://stackoverflow.com/questions/42681387
最满意答案
如果使用Marionette视图类型上的
bindTo
方法绑定它们,是:SomeView = Backbone.Marionette.ItemView.extend({ initialize: function(){ // note the use of the 4th parameter. this is important when binding // to the App's event aggregator this.bindTo(MyApp.vent, "some:event", this.someCallback, this); }, someCallback: function(){ // ... } });
现在,关闭SomeView实例将取消绑定事件聚合器事件。
If you bind them with the
bindTo
method on the Marionette view types, yes:SomeView = Backbone.Marionette.ItemView.extend({ initialize: function(){ // note the use of the 4th parameter. this is important when binding // to the App's event aggregator this.bindTo(MyApp.vent, "some:event", this.someCallback, this); }, someCallback: function(){ // ... } });
Closing an instance of SomeView will unbind the event aggregator events, now.
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
你不能把Java家伙带到任何地方。 答案(在Javascript中)是我需要唯一地命名我的事件。 当你想到它时会有意义。 虽然我使用X11 / Java的大多数事件系统都没有为您的活动命名,但您使用的是他们给您的内容。 这是关于事件命名的stackoverflow问题。 我希望我的公共学习能够帮助他人。 ;-) You just can't take us Java guys anywhere. The answer (in Javascript) is that I do need to name my ...
-
Backbonejs:如何在删除视图时取消绑定集合绑定?(Backbonejs: How to unbind collection bindings when a view is removed?)[2023-03-09]
您可以相当一般地概括您的问题。 基本上,您正在编写一个事件驱动的应用程序,在这样的应用程序事件应该得到照顾。 查看此帖子 ,了解在骨干网中使用事件处理程序的推荐方法。 You can generalize your problem quite a bit. Basically, you are writing an event-driven app, and in such app events should be taken care of. Check out this post to see a re ... -
为什么在骨干全局事件调度程序中使用名为“vent”的变量(Why use a variable named 'vent' in a backbone global event despatcher)[2021-10-13]
可能只是maronette.js项目的惯例 。 https://github.com/marionettejs/backbone.marionette/blob/0c62b6e5cb63763b388a3d7af7df5ad4a64adb33/src/marionette.application.js#L10 也许他们喜欢它,因为“发泄”是一个动词? 我个人更喜欢“发射”而事件不是保留关键字 。 Probably just convention from the maronette.js project. ... -
目标C - Calendar如何向事件添加文件附件?(Objective C - How does Calendar adds file attachments to events?)[2023-08-02]
你的问题没有一个答案。 这取决于服务器(Fruux,iCloud,Exchange,Yahoo,...),客户端版本等。 有一个简单的答案:我可以使用EventKit API附加文件吗? 不,你不能。 EventKit功能非常有限。 'notes'属性映射到(第一个或最后一个?...) iCalendar描述属性。 对于iCloud和OSX服务器,OSX / iOS客户端应该执行CalDAV管理的附件 。 对于不支持此服务器的服务器,客户端可能会内联iCalendar附件中的附件 。 但是,如果我没记错的话 ... -
很长的帖子,如果您有任何疑问,请询问 僵尸视图只是一个不在DOM中的视图,但是监听事件并对事件作出反应 - 有时这种行为是预期的,但通常不是。 如果未正确删除视图的DOM事件处理程序,则不会对视图及其内存中的HTML片段进行垃圾回收。 如果Backbone.Event处理程序未正确绑定,您可能会遇到各种不良行为......例如一堆“Zombie”视图触发模型上的AJAX请求。 在stopListening和listenTo之前的旧版Backbone上,这个问题非常常见,尤其是如果您在视图之间共享模型。 在您 ...
-
如果使用Marionette视图类型上的bindTo方法绑定它们,是: SomeView = Backbone.Marionette.ItemView.extend({ initialize: function(){ // note the use of the 4th parameter. this is important when binding // to the App's event aggregator this.bindTo(MyApp.vent, "some ...
-
您需要在ViewWillAppear中隐藏View1的导航栏,并在转到viewWillDisappear时取消隐藏: 视图1: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController.navigationBar setHidden:true]; } - (void)viewWillDisappear:(BOOL)animated { [su ...
-
Marionette.js关于事件以及如何正确解开它们的问题(Marionette.js questions about events and how to correctly unbind them)[2023-11-21]
控制器和视图正确地执行清洁工作,但模块不执行此操作。 这是更详细的信息: 调节器 如果关闭控制器,它将取消绑定在控制器上下文中使用listenTo绑定的所有事件。 您可以查看控制器源代码 。 视图 根据Backbone.View 源代码 remove方法做stopListening 。 此外,Marionette.View的close呼叫主干在引擎盖下remove 。 这是源代码 。 模 我已经检查了Marionette.Module 源代码但是在stop方法中没有stopListening 。 因此, M ...