package education.jtrainer.tutorial.junit; public class CarFactory { public Car getCar(String carType){ for (CarType m : CarType.values()) { if (m.toString().equals(carType)) { return new Car(m); } } return null; } }
A Java educational site
package education.jtrainer.tutorial.junit; public class CarFactory { public Car getCar(String carType){ for (CarType m : CarType.values()) { if (m.toString().equals(carType)) { return new Car(m); } } return null; } }