Selaa lähdekoodia

updated `InvalidPhoneNumberFormatException` class

Leon 6 vuotta sitten
vanhempi
commit
0665dd6f3d

+ 1
- 1
src/main/java/com/zipcodewilmington/phone/PhoneNumberFactory.java Näytä tiedosto

@@ -26,7 +26,7 @@ public final class PhoneNumberFactory {
26 26
     /**
27 27
      * @return an instance of PhoneNumber with randomly generated phone number value
28 28
      */ //TODO - Implement logic
29
-    private static PhoneNumber createRandomPhoneNumber() {
29
+    public static PhoneNumber createRandomPhoneNumber() {
30 30
         return createPhoneNumberSafely(-1, -1, -1);
31 31
     }
32 32
 

+ 4
- 6
src/test/java/com/zipcodewilmington/PhoneNumberFactoryTest.java Näytä tiedosto

@@ -79,12 +79,10 @@ public class PhoneNumberFactoryTest {
79 79
 
80 80
     @Test
81 81
     public void testCreateRandomPhoneNumber() {
82
-        Logger.getGlobal().setLevel(Level.OFF);
83
-        // : Given
84
-        PhoneNumber[] phoneNumbers = PhoneNumberFactory.createRandomPhoneNumberArray(999);
85
-
86
-        // : When
87
-        for (PhoneNumber phoneNumber : phoneNumbers) {
82
+        for (int i = 0; i < 999; i++) {
83
+            // : Given
84
+            // : When
85
+            PhoneNumber phoneNumber = PhoneNumberFactory.createRandomPhoneNumber();
88 86
 
89 87
             // : Then
90 88
             Assert.assertTrue(phoneNumber != null);