@Test public void testCreateSecondaryConfigAndProtocolConfigException() { String clientType = "badProtocol"; String primaryConfig = "${etiqet.directory}/etiqet-core/src/test/resources/properties/testConfig.properties"; String secondaryConfig = "${etiqet.directory}/etiqet-core/src/test/resources/properties/testConfig2.properties"; try { ClientFactory.create(clientType, primaryConfig, secondaryConfig, mock(ProtocolConfig.class)); fail("'badProtocol' should not exist for this test."); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals(String.format(ClientFactory.CLIENT_CREATION_ERROR, clientType), e.getMessage()); } }
public static Client create(String clientType) throws EtiqetException { ProtocolConfig protocol = GlobalConfig.getInstance().getProtocol(clientType); if (protocol == null) { throw new UnhandledProtocolException(String.format(PROTOCOL_ERROR, clientType)); } return create(clientType, protocol.getClient().getDefaultConfig()); }
ClientFactory { public static Client create(String clientType) throws EtiqetException { ProtocolConfig protocol = GlobalConfig.getInstance().getProtocol(clientType); if (protocol == null) { throw new UnhandledProtocolException(String.format(PROTOCOL_ERROR, clientType)); } return create(clientType, protocol.getClient().getDefaultConfig()); } }
ClientFactory { public static Client create(String clientType) throws EtiqetException { ProtocolConfig protocol = GlobalConfig.getInstance().getProtocol(clientType); if (protocol == null) { throw new UnhandledProtocolException(String.format(PROTOCOL_ERROR, clientType)); } return create(clientType, protocol.getClient().getDefaultConfig()); } private  ClientFactory(); }
ClientFactory { public static Client create(String clientType) throws EtiqetException { ProtocolConfig protocol = GlobalConfig.getInstance().getProtocol(clientType); if (protocol == null) { throw new UnhandledProtocolException(String.format(PROTOCOL_ERROR, clientType)); } return create(clientType, protocol.getClient().getDefaultConfig()); } private  ClientFactory(); static Client create(String clientType); static Client create(String clientType, String config); static Client create(String clientType, String primaryConfig, String secondaryConfig); static Client create(
        String clientType,
        String primaryConfig,
        String secondaryConfig,
        ProtocolConfig protocolConfig
    ); }
ClientFactory { public static Client create(String clientType) throws EtiqetException { ProtocolConfig protocol = GlobalConfig.getInstance().getProtocol(clientType); if (protocol == null) { throw new UnhandledProtocolException(String.format(PROTOCOL_ERROR, clientType)); } return create(clientType, protocol.getClient().getDefaultConfig()); } private  ClientFactory(); static Client create(String clientType); static Client create(String clientType, String config); static Client create(String clientType, String primaryConfig, String secondaryConfig); static Client create(
        String clientType,
        String primaryConfig,
        String secondaryConfig,
        ProtocolConfig protocolConfig
    );  }