@Test public void testGetStrategy() throws Exception { assertTrue(StrategyFactory.getStrategy(sxpNode, Version.Version4) instanceof Sxpv4); assertTrue(StrategyFactory.getStrategy(sxpNode, Version.Version3) instanceof SxpLegacy); assertTrue(StrategyFactory.getStrategy(sxpNode, Version.Version2) instanceof SxpLegacy); assertTrue(StrategyFactory.getStrategy(sxpNode, Version.Version1) instanceof SxpLegacy); exception.expect(UnknownVersionException.class); assertTrue(StrategyFactory.getStrategy(sxpNode, null) instanceof SxpLegacy); }
public static Strategy getStrategy(SxpNode ownerNode, Version version) { if (version != null) { switch (version) { case Version1: case Version2: case Version3: return new SxpLegacy(version); case Version4: return new Sxpv4(ownerNode); } } throw new UnknownVersionException(); }
StrategyFactory { public static Strategy getStrategy(SxpNode ownerNode, Version version) { if (version != null) { switch (version) { case Version1: case Version2: case Version3: return new SxpLegacy(version); case Version4: return new Sxpv4(ownerNode); } } throw new UnknownVersionException(); } }
StrategyFactory { public static Strategy getStrategy(SxpNode ownerNode, Version version) { if (version != null) { switch (version) { case Version1: case Version2: case Version3: return new SxpLegacy(version); case Version4: return new Sxpv4(ownerNode); } } throw new UnknownVersionException(); } private  StrategyFactory(); }
StrategyFactory { public static Strategy getStrategy(SxpNode ownerNode, Version version) { if (version != null) { switch (version) { case Version1: case Version2: case Version3: return new SxpLegacy(version); case Version4: return new Sxpv4(ownerNode); } } throw new UnknownVersionException(); } private  StrategyFactory(); static Strategy getStrategy(SxpNode ownerNode, Version version); }
StrategyFactory { public static Strategy getStrategy(SxpNode ownerNode, Version version) { if (version != null) { switch (version) { case Version1: case Version2: case Version3: return new SxpLegacy(version); case Version4: return new Sxpv4(ownerNode); } } throw new UnknownVersionException(); } private  StrategyFactory(); static Strategy getStrategy(SxpNode ownerNode, Version version);  }