OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, the Dart project authors. | 2 * Copyright (c) 2014, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Mockito.verifyNoMoreInteractions(listener); | 228 Mockito.verifyNoMoreInteractions(listener); |
229 } | 229 } |
230 | 230 |
231 public void testSourceContainerRemoved_ignored() throws Exception { | 231 public void testSourceContainerRemoved_ignored() throws Exception { |
232 SourceContainerDeltaEvent event = newSourceContainerDeltaEvent(); | 232 SourceContainerDeltaEvent event = newSourceContainerDeltaEvent(); |
233 ignoreManager.addToIgnores(event.getResource().getLocation()); | 233 ignoreManager.addToIgnores(event.getResource().getLocation()); |
234 newTarget().sourceContainerRemoved(event); | 234 newTarget().sourceContainerRemoved(event); |
235 Mockito.verifyNoMoreInteractions(listener); | 235 Mockito.verifyNoMoreInteractions(listener); |
236 } | 236 } |
237 | 237 |
| 238 public void testSourceContainerRemoved_null() throws Exception { |
| 239 SourceContainerDeltaEvent event = newSourceContainerDeltaEvent_nullResource(
); |
| 240 ignoreManager.addToIgnores(project.getFolder("web")); |
| 241 newTarget().sourceContainerRemoved(event); |
| 242 Mockito.verifyNoMoreInteractions(listener); |
| 243 } |
| 244 |
238 public void testSourceContainerRemoved_unignored() throws Exception { | 245 public void testSourceContainerRemoved_unignored() throws Exception { |
239 SourceContainerDeltaEvent event = newSourceContainerDeltaEvent(); | 246 SourceContainerDeltaEvent event = newSourceContainerDeltaEvent(); |
240 ignoreManager.addToIgnores(event.getResource().getLocation()); | 247 ignoreManager.addToIgnores(event.getResource().getLocation()); |
241 ignoreManager.removeFromIgnores(event.getResource().getLocation()); | 248 ignoreManager.removeFromIgnores(event.getResource().getLocation()); |
242 newTarget().sourceContainerRemoved(event); | 249 newTarget().sourceContainerRemoved(event); |
243 Mockito.verify(listener).sourceContainerRemoved(event); | 250 Mockito.verify(listener).sourceContainerRemoved(event); |
244 Mockito.verifyNoMoreInteractions(listener); | 251 Mockito.verifyNoMoreInteractions(listener); |
245 } | 252 } |
246 | 253 |
247 public void testSourceRemoved() throws Exception { | 254 public void testSourceRemoved() throws Exception { |
248 SourceDeltaEvent event = newSourceDeltaEvent(); | 255 SourceDeltaEvent event = newSourceDeltaEvent(); |
249 newTarget().sourceRemoved(event); | 256 newTarget().sourceRemoved(event); |
250 Mockito.verify(listener).sourceRemoved(event); | 257 Mockito.verify(listener).sourceRemoved(event); |
251 Mockito.verifyNoMoreInteractions(listener); | 258 Mockito.verifyNoMoreInteractions(listener); |
252 } | 259 } |
253 | 260 |
254 public void testSourceRemoved_ignored() throws Exception { | 261 public void testSourceRemoved_ignored() throws Exception { |
255 SourceDeltaEvent event = newSourceDeltaEvent(); | 262 SourceDeltaEvent event = newSourceDeltaEvent(); |
256 ignoreManager.addToIgnores(event.getResource().getLocation()); | 263 ignoreManager.addToIgnores(event.getResource().getLocation()); |
257 newTarget().sourceRemoved(event); | 264 newTarget().sourceRemoved(event); |
258 Mockito.verifyNoMoreInteractions(listener); | 265 Mockito.verifyNoMoreInteractions(listener); |
259 } | 266 } |
260 | 267 |
| 268 public void testSourceRemoved_null() throws Exception { |
| 269 SourceDeltaEvent event = newSourceDeltaEvent_nullResource(); |
| 270 ignoreManager.addToIgnores(project.getFolder("web").getFile("other.dart")); |
| 271 newTarget().sourceRemoved(event); |
| 272 Mockito.verifyNoMoreInteractions(listener); |
| 273 } |
| 274 |
261 public void testSourceRemoved_unignored() throws Exception { | 275 public void testSourceRemoved_unignored() throws Exception { |
262 SourceDeltaEvent event = newSourceDeltaEvent(); | 276 SourceDeltaEvent event = newSourceDeltaEvent(); |
263 ignoreManager.addToIgnores(event.getResource().getLocation()); | 277 ignoreManager.addToIgnores(event.getResource().getLocation()); |
264 ignoreManager.removeFromIgnores(event.getResource().getLocation()); | 278 ignoreManager.removeFromIgnores(event.getResource().getLocation()); |
265 newTarget().sourceRemoved(event); | 279 newTarget().sourceRemoved(event); |
266 Mockito.verify(listener).sourceRemoved(event); | 280 Mockito.verify(listener).sourceRemoved(event); |
267 Mockito.verifyNoMoreInteractions(listener); | 281 Mockito.verifyNoMoreInteractions(listener); |
268 } | 282 } |
269 | 283 |
270 public void testVisitContext() throws Exception { | 284 public void testVisitContext() throws Exception { |
(...skipping 28 matching lines...) Expand all Loading... |
299 listener = Mockito.mock(DeltaListener.class); | 313 listener = Mockito.mock(DeltaListener.class); |
300 } | 314 } |
301 | 315 |
302 private SourceContainerDeltaEvent newSourceContainerDeltaEvent() { | 316 private SourceContainerDeltaEvent newSourceContainerDeltaEvent() { |
303 IFolder folder = project.getFolder("web"); | 317 IFolder folder = project.getFolder("web"); |
304 SourceContainerDeltaEvent event = Mockito.mock(SourceContainerDeltaEvent.cla
ss); | 318 SourceContainerDeltaEvent event = Mockito.mock(SourceContainerDeltaEvent.cla
ss); |
305 Mockito.when(event.getResource()).thenReturn(folder); | 319 Mockito.when(event.getResource()).thenReturn(folder); |
306 return event; | 320 return event; |
307 } | 321 } |
308 | 322 |
| 323 private SourceContainerDeltaEvent newSourceContainerDeltaEvent_nullResource()
{ |
| 324 SourceContainerDeltaEvent event = Mockito.mock(SourceContainerDeltaEvent.cla
ss); |
| 325 Mockito.when(event.getResource()).thenReturn(null); |
| 326 return event; |
| 327 } |
| 328 |
309 private SourceDeltaEvent newSourceDeltaEvent() { | 329 private SourceDeltaEvent newSourceDeltaEvent() { |
310 IFile file = project.getFolder("web").getFile("other.dart"); | 330 IFile file = project.getFolder("web").getFile("other.dart"); |
311 SourceDeltaEvent event = Mockito.mock(SourceDeltaEvent.class); | 331 SourceDeltaEvent event = Mockito.mock(SourceDeltaEvent.class); |
312 Mockito.when(event.getResource()).thenReturn(file); | 332 Mockito.when(event.getResource()).thenReturn(file); |
313 return event; | 333 return event; |
314 } | 334 } |
315 | 335 |
| 336 private SourceDeltaEvent newSourceDeltaEvent_nullResource() { |
| 337 SourceDeltaEvent event = Mockito.mock(SourceDeltaEvent.class); |
| 338 Mockito.when(event.getResource()).thenReturn(null); |
| 339 return event; |
| 340 } |
| 341 |
316 private IgnoreResourceFilter newTarget() { | 342 private IgnoreResourceFilter newTarget() { |
317 IgnoreResourceFilter filter = new IgnoreResourceFilter(ignoreManager); | 343 IgnoreResourceFilter filter = new IgnoreResourceFilter(ignoreManager); |
318 filter.addDeltaListener(listener); | 344 filter.addDeltaListener(listener); |
319 return filter; | 345 return filter; |
320 } | 346 } |
321 } | 347 } |
OLD | NEW |