From 6f4f10e01060eed71bc9babe166ef3c662de9028 Mon Sep 17 00:00:00 2001 From: amin Date: Thu, 11 Jul 2024 16:28:51 +0100 Subject: [PATCH] docs: change the main file to be aling with the subject --- .../factory-blueprint/ExerciseRunner.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/subjects/java/checkpoints/factory-blueprint/ExerciseRunner.java b/subjects/java/checkpoints/factory-blueprint/ExerciseRunner.java index fab7e7957..2457a2f4c 100644 --- a/subjects/java/checkpoints/factory-blueprint/ExerciseRunner.java +++ b/subjects/java/checkpoints/factory-blueprint/ExerciseRunner.java @@ -2,7 +2,20 @@ public class ExerciseRunner { public static void main(String[] args) { Factory factory = new Factory(); - // Handle invalid product type + ConcreteProductA productA = factory.createProduct("A"); + if (productA != null) { + productA.showDetails(); + } else { + System.out.println("Invalid product type"); + } + + ConcreteProductA productB = factory.createProduct("B"); + if (productB != null) { + productB.showDetails(); + } else { + System.out.println("Invalid product type"); + } + Object invalidProduct = factory.createProduct("C"); if (invalidProduct != null) { invalidProduct.showDetails();