package controllers;

import org.junit.*;

import java.util.*;

import play.mvc.*;
import play.test.*;
import play.libs.F.*;

import static play.test.Helpers.*;
import static org.fest.assertions.Assertions.*;

/**
 * User: doortts
 * Date: 12. 9. 3
 * Time: 오후 5:36
 */
public class UserAppTest {
    @Test
    public void findById_doesntExist() {
        running(fakeApplication(), new Runnable() {
            public void run() {
                Map<String,String> data = new HashMap<String,String>();
                data.put("loginId", "nekure");

                Result result = callAction(
                        controllers.routes.ref.UserApp.isUserExist("nekure"),
                        fakeRequest().withFormUrlEncodedBody(data)
                );

                assertThat(status(result)).isEqualTo(OK);
                assertThat(contentAsString(result)).contains("{\"isExist\":\"false\"}");
            }
        });
    }

    @Test
    public void findById_alreadyExist() {
        running(fakeApplication(), new Runnable() {
            public void run() {
                Map<String,String> data = new HashMap<String,String>();
                data.put("loginId", "hobi");

                Result result = callAction(
                        controllers.routes.ref.UserApp.isUserExist("hobi"),
                        fakeRequest().withFormUrlEncodedBody(data)
                );

                assertThat(status(result)).isEqualTo(OK);
                assertThat(contentAsString(result)).contains("{\"isExist\":\"true\"}");
            }
        });
    }

}

@@ -79,50 +79,8 @@
 c.*;
-%0Aimport play.test.*;%0Aimport play.libs.F.*;
 %0A%0Aim
@@ -433,37 +433,24 @@
 new HashMap%3C
-String,String
 %3E();%0A       
@@ -689,32 +689,91 @@
               );
+  // fakeRequest doesn't need here, but remains for example
 %0A%0A              
@@ -1128,29 +1128,16 @@
 HashMap%3C
-String,String
 %3E();%0A   
@@ -1384,16 +1384,74 @@
       );
+ // fakeRequest doesn't need here, but remains for example
 %0A%0A      
@@ -1616,17 +1616,16 @@
     %7D);%0A
+
     %7D%0A
-%0A
 %7D%0A

remove unused commnets & add some comments