11package com .siftscience ;
22
33import static java .net .HttpURLConnection .HTTP_OK ;
4+ import java .util .ArrayList ;
5+ import java .util .Collection ;
6+ import java .util .List ;
47
58import com .siftscience .model .EventResponseBody ;
69import com .siftscience .model .FlagContentFieldSet ;
1013import okhttp3 .mockwebserver .RecordedRequest ;
1114import org .junit .Assert ;
1215import org .junit .Test ;
16+ import org .junit .runner .RunWith ;
17+ import org .junit .runners .Parameterized ;
1318import org .skyscreamer .jsonassert .JSONAssert ;
1419
20+ @ RunWith (Parameterized .class )
1521public class FlagContentEventTest {
22+
23+ @ Parameterized .Parameters
24+ public static Collection <Object []> data () {
25+ FlagContentFieldSet .FlagContentReason [] values = FlagContentFieldSet .FlagContentReason .values ();
26+ List <Object []> data = new ArrayList <>(values .length );
27+ for (FlagContentFieldSet .FlagContentReason reason : values ) {
28+ data .add (new Object [] { reason });
29+ }
30+ return data ;
31+ }
32+
33+ private final FlagContentFieldSet .FlagContentReason reason ;
34+
35+ public FlagContentEventTest (FlagContentFieldSet .FlagContentReason reason ) {
36+ this .reason = reason ;
37+ }
1638 @ Test
1739 public void testFlagContent () throws Exception {
1840 String expectedRequestBody = "{\n " +
@@ -22,7 +44,7 @@ public void testFlagContent() throws Exception {
2244 " \" $content_id\" : \" 9671500641\" ,\n " +
2345 "\n " +
2446 " \" $flagged_by\" : \" jamieli89\" ,\n " +
25- " \" $reason\" : \" $toxic \" ,\n " +
47+ " \" $reason\" : \" " + this . reason . value + " \" ,\n " +
2648 " \" $user_email\" : \" billy_jones_301@email.com\" ,\n " +
2749 " \" $verification_phone_number\" : \" +12345678901\" \n " +
2850 "}" ;
@@ -52,7 +74,7 @@ public void testFlagContent() throws Exception {
5274 .setUserId ("billy_jones_301" )
5375 .setContentId ("9671500641" )
5476 .setFlaggedBy ("jamieli89" )
55- .setReason (FlagContentFieldSet . FlagContentReason . TOXIC )
77+ .setReason (this . reason )
5678 .setUserEmail ("billy_jones_301@email.com" )
5779 .setVerificationPhoneNumber ("+12345678901" ));
5880
0 commit comments