@Test(expected = StorageDriverException.class) public void givenIncorrectPropertiesThenRaiseAnException() throws Exception { final Properties props = new Properties(); props.setProperty("fail", "fail"); StorageOffer offer = new StorageOffer(); offer.setId("fail"); driver.connect(offer.getId()); }
@Override public Connection connect(String offerId) throws StorageDriverException { if (offerId.contains("fail")) { throw new StorageDriverException(getName(), "Intentionaly thrown", false); } return new FakeConnectionImpl(offerId); }
FakeDriverImpl extends AbstractDriver { @Override public Connection connect(String offerId) throws StorageDriverException { if (offerId.contains("fail")) { throw new StorageDriverException(getName(), "Intentionaly thrown", false); } return new FakeConnectionImpl(offerId); } }
FakeDriverImpl extends AbstractDriver { @Override public Connection connect(String offerId) throws StorageDriverException { if (offerId.contains("fail")) { throw new StorageDriverException(getName(), "Intentionaly thrown", false); } return new FakeConnectionImpl(offerId); }  }
FakeDriverImpl extends AbstractDriver { @Override public Connection connect(String offerId) throws StorageDriverException { if (offerId.contains("fail")) { throw new StorageDriverException(getName(), "Intentionaly thrown", false); } return new FakeConnectionImpl(offerId); }  @Override Connection connect(String offerId); @Override boolean isStorageOfferAvailable(String offerId); @Override String getName(); @Override int getMajorVersion(); @Override int getMinorVersion(); }
FakeDriverImpl extends AbstractDriver { @Override public Connection connect(String offerId) throws StorageDriverException { if (offerId.contains("fail")) { throw new StorageDriverException(getName(), "Intentionaly thrown", false); } return new FakeConnectionImpl(offerId); }  @Override Connection connect(String offerId); @Override boolean isStorageOfferAvailable(String offerId); @Override String getName(); @Override int getMajorVersion(); @Override int getMinorVersion();  }