回答編集履歴
3
修正
answer
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
```APEX
|
25
25
|
public class ContactSearch {
|
26
26
|
public static List<Contact> searchForContacts(String lastName, String postNum){
|
27
|
-
List<Contact> Contacts = [Select Id, Name from Contact where LastName = :lastname AND MailingPostalCode = :postNum ];
|
27
|
+
List<Contact> Contacts = [Select Id, Name from Contact where LastName = :lastname AND MailingPostalCode = :postNum ORDER BY Id LIMIT 1];
|
28
28
|
return Contacts;
|
29
29
|
}
|
30
30
|
}
|
2
再調整
answer
CHANGED
@@ -23,11 +23,21 @@
|
|
23
23
|
|
24
24
|
```APEX
|
25
25
|
public class ContactSearch {
|
26
|
-
public static List<Contact>
|
26
|
+
public static List<Contact> searchForContacts(String lastName, String postNum){
|
27
|
-
|
27
|
+
List<Contact> Contacts = [Select Id, Name from Contact where LastName = :lastname AND MailingPostalCode = :postNum ];
|
28
28
|
return Contacts;
|
29
29
|
}
|
30
30
|
}
|
31
31
|
```
|
32
|
-
これで良いかと思うんだけどうかな?
|
33
|
-
テストクラス
|
32
|
+
テストクラス
|
33
|
+
```APEX
|
34
|
+
@isTest
|
35
|
+
public class ContactSearchTest {
|
36
|
+
@isTest static void searchForContacts() {
|
37
|
+
Test.startTest();
|
38
|
+
List<Contact> Contacts = ContactSearch.searchForContacts('Rogers', '27215');
|
39
|
+
System.assertEquals(Contacts.size() != 1, true);
|
40
|
+
Test.stopTest();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
1
修正
answer
CHANGED
@@ -24,8 +24,8 @@
|
|
24
24
|
```APEX
|
25
25
|
public class ContactSearch {
|
26
26
|
public static List<Contact> searchForContact(String lastName, String postNum){
|
27
|
-
|
27
|
+
List<Contact> Contacts = [Select ID,Name from Contact where LastName = :lastname AND MailingPostalCode = :postNum ];
|
28
|
-
return
|
28
|
+
return Contacts;
|
29
29
|
}
|
30
30
|
}
|
31
31
|
```
|