TestFactory.java (705B)
1 package eu.siacs.compliance; 2 3 import eu.siacs.compliance.tests.AbstractTest; 4 import rocks.xmpp.core.session.XmppClient; 5 6 public class TestFactory { 7 8 public static AbstractTest create(Class <? extends AbstractTest> clazz, XmppClient client) throws TestCreationException { 9 if (client == null) { 10 throw new TestCreationException(); 11 } 12 try { 13 AbstractTest test = clazz.getDeclaredConstructor(XmppClient.class).newInstance(client); 14 return test; 15 } catch (Exception e) { 16 e.printStackTrace(); 17 throw new TestCreationException(); 18 } 19 } 20 21 public static class TestCreationException extends Exception { 22 23 } 24 }