Skip to content

Instantly share code, notes, and snippets.

@jasongonzales23
Created July 18, 2012 15:31
Show Gist options
  • Save jasongonzales23/3136949 to your computer and use it in GitHub Desktop.
Save jasongonzales23/3136949 to your computer and use it in GitHub Desktop.
import org.codehaus.groovy.grails.web.json.JSONObject;
import grails.converters.JSON;
import groovy.util.GroovyTestCase;
import org.springframework.mock.web.MockHttpServletResponse;
public class UserServiceTests extends GroovyTestCase {
def userService;
@Override
protected void setUp() throws Exception {
super.setUp();
userService = new UserService();
}
void testHasBillingPermission_withErrorResponse() {
def json = new JSONObject()
json.code = "error.invalid.from.date"
def result = new ErrorResponseData(400, json)
println(result);
def request = [
userId: 1,
billingPermissions: result
]
println(request);
def data = userService.hasBillingPermission(request, BillingPermissions.ADD_DW_ACCOUNT );
println(data);
assert data == true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment