public static EBookFormat fromFormat(String sFormat) { // The following should only ever happen in test mode! // It is not cnvenient in test to call the routine to initialise // the list of formats so we simply assume it is valid // We therefore 'fudge' a return value to get tests to work if (supportedFormats == null) { return new EBookFormat(sFormat, "mimetestdummy"); } for (EBookFormat format : supportedFormats) { if (format.getName().equalsIgnoreCase(sFormat)) return format; } return null; }