Sfoglia il codice sorgente

updated `InvalidPhoneNumberFormatException` class

Leon 6 anni fa
parent
commit
0665dd6f3d

+ 1
- 1
src/main/java/com/zipcodewilmington/phone/PhoneNumberFactory.java Vedi File

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

+ 4
- 6
src/test/java/com/zipcodewilmington/PhoneNumberFactoryTest.java Vedi File

79
 
79
 
80
     @Test
80
     @Test
81
     public void testCreateRandomPhoneNumber() {
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
             // : Then
87
             // : Then
90
             Assert.assertTrue(phoneNumber != null);
88
             Assert.assertTrue(phoneNumber != null);