private Scoop getActiveScoop(final RouteChange routeChange) { Scoop rootScoop = Scoop.fromView(this); Scoop currentScreenScoop = Scoop.fromView(active); return getScreenScooper().create(rootScoop, currentScreenScoop, routeChange.fromPath, routeChange.toPath); }
private Scoop getActiveScoop(final RouteChange routeChange) { Scoop rootScoop = Scoop.fromView(this); Scoop currentScreenScoop = Scoop.fromView(active); return getScreenScooper().create(rootScoop, currentScreenScoop, routeChange.fromPath, routeChange.toPath); }
@Test public void createScoopFromEmptyPathToEmptyPath() { Scoop scoop = screenScooper.create(rootScoop, null, Collections.<Screen>emptyList(), Collections.<Screen>emptyList()); assertFalse(rootScoop.isDestroyed()); assertNull(scoop); }
@Test public void createScoopFromABPathToEmptyPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(); Scoop scoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertNull(scoop); }
@Test public void createScoopFromEmptyPathToAPath() { List<Screen> toPath = Arrays.<Screen>asList(new ScreenA()); Scoop aScoop = screenScooper.create(rootScoop, null, Collections.<Screen>emptyList(), toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(aScoop.isDestroyed()); assertEquals(rootScoop, aScoop.getParent()); }
@Test public void createScoopFromAPathToBPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenB()); Scoop bScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(bScoop.isDestroyed()); assertFalse(rootScoop.isDestroyed()); assertEquals(rootScoop, bScoop.getParent()); }
@Test public void createScoopFromABPathToAPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA()); Scoop scoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertEquals(rootScoop, scoop.getParent()); }
@Test public void createScoopFromEmptyPathToABPath() { List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); Scoop bScoop = screenScooper.create(rootScoop, null, Collections.<Screen>emptyList(), toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(bScoop.getParent().isDestroyed()); assertFalse(bScoop.isDestroyed()); assertEquals(rootScoop, bScoop.getParent().getParent()); }
@Test public void createScoopFromAPathToABPathWithNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); Scoop bScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(bScoop.isDestroyed()); assertEquals(rootScoop, bScoop.getParent().getParent()); }
@Test public void createScoopFromABCPathToAPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB(), new ScreenC()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA()); Scoop scoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(scoop.isDestroyed()); assertFalse(rootScoop.isDestroyed()); assertEquals(rootScoop, scoop.getParent()); }
@Test public void createScoopFromAPathToABPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop bScoop = screenScooper.create(rootScoop, aScoop, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(aScoop.isDestroyed()); assertFalse(bScoop.isDestroyed()); assertEquals(aScoop, bScoop.getParent()); }
@Test public void createScoopFromABPathToACPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenC()); Scoop cScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); //A assertFalse(cScoop.getParent().isDestroyed()); assertFalse(cScoop.isDestroyed()); assertEquals(rootScoop, cScoop.getParent().getParent()); }
@Test public void createScoopFromABPathToCDPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenC(), new ScreenD()); Scoop dScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(dScoop.getParent().isDestroyed()); assertFalse(dScoop.isDestroyed()); assertEquals(rootScoop, dScoop.getParent().getParent()); }
@Test public void createScoopFromAPathToBPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenB()); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop bScoop = screenScooper.create(rootScoop, aScoop, fromPath, toPath); assertTrue(aScoop.isDestroyed()); assertFalse(bScoop.isDestroyed()); assertFalse(rootScoop.isDestroyed()); assertEquals(rootScoop, bScoop.getParent()); }
@Test public void createScoopFromAPathToABCPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB(), new ScreenC()); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop cScoop = screenScooper.create(rootScoop, aScoop, fromPath, toPath); assertFalse(cScoop.getParent().isDestroyed()); assertFalse(cScoop.isDestroyed()); assertFalse(aScoop.isDestroyed()); assertFalse(rootScoop.isDestroyed()); assertEquals(aScoop, cScoop.getParent().getParent()); }
@Test public void createScoopFromABPathToEmptyPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop bScoop = screenScoopFactory.createScreenScoop(new ScreenB(), aScoop); Scoop scoop = screenScooper.create(rootScoop, bScoop, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertTrue(aScoop.isDestroyed()); assertTrue(bScoop.isDestroyed()); assertNull(scoop); }
@Test public void createScoopFromABPathToABCPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB(), new ScreenC()); Scoop cScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(cScoop.getParent().getParent().isDestroyed()); assertFalse(cScoop.getParent().isDestroyed()); assertFalse(cScoop.isDestroyed()); assertEquals(rootScoop, cScoop.getParent().getParent().getParent()); }
@Test public void createScoopFromABPathToAPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA()); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop bScoop = screenScoopFactory.createScreenScoop(new ScreenB(), aScoop); Scoop scoop = screenScooper.create(rootScoop, bScoop, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(aScoop.isDestroyed()); assertTrue(bScoop.isDestroyed()); assertEquals(aScoop, scoop); }
@Test public void createScoopFromABCPathToABDPathNullCurrentScoop() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB(), new ScreenC()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB(), new ScreenD()); Scoop dScoop = screenScooper.create(rootScoop, null, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(dScoop.getParent().getParent().isDestroyed()); assertFalse(dScoop.getParent().isDestroyed()); assertFalse(dScoop.isDestroyed()); assertEquals(rootScoop, dScoop.getParent().getParent().getParent()); }
@Test public void createScoopFromABPathToACPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenC()); Scoop aScoop = screenScoopFactory.createScreenScoop(new ScreenA(), rootScoop); Scoop bScoop = screenScoopFactory.createScreenScoop(new ScreenB(), aScoop); Scoop cScoop = screenScooper.create(rootScoop, bScoop, fromPath, toPath); assertFalse(rootScoop.isDestroyed()); assertFalse(aScoop.isDestroyed()); assertTrue(bScoop.isDestroyed()); assertFalse(cScoop.isDestroyed()); assertEquals(aScoop, cScoop.getParent()); }