@Test(expected = NullPointerException.class) public void testGetTravelStrategy() { TravelStrategy strategy = factory.get(null); Assert.assertNull(strategy); }
public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; }
TravelFactory implements Iterable<TravelStrategy> { public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; } }
TravelFactory implements Iterable<TravelStrategy> { public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; } private  TravelFactory(); }
TravelFactory implements Iterable<TravelStrategy> { public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; } private  TravelFactory(); static TravelFactory getInstance(); @Override Iterator<TravelStrategy> iterator(); TravelStrategy get(TravelId id); }
TravelFactory implements Iterable<TravelStrategy> { public TravelStrategy get(TravelId id) throws NullPointerException { TravelStrategy strategy = allModules.get(id); if (strategy == null) { throw new NullPointerException(); } return strategy; } private  TravelFactory(); static TravelFactory getInstance(); @Override Iterator<TravelStrategy> iterator(); TravelStrategy get(TravelId id);  }