Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
test for json not having id feild when updating
Browse files Browse the repository at this point in the history
  • Loading branch information
JKereliuk committed Jul 9, 2015
1 parent 4b359b4 commit 5fbae30
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -18,6 +18,7 @@
package org.phenotips.data.rest.internal;

import com.xpn.xwiki.XWikiContext;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.MultiValueMap;
import org.junit.Before;
Expand Down Expand Up @@ -49,6 +50,7 @@
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.security.authorization.Right;
import org.xwiki.test.mockito.MockitoComponentMockingRule;
import org.xwiki.text.StringUtils;
import org.xwiki.users.UserManager;

import javax.ws.rs.WebApplicationException;
Expand All @@ -62,6 +64,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;

import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;

Expand Down Expand Up @@ -196,5 +199,15 @@ public void updatePatientNoAccessReturnsForbiddenCode() throws ComponentLookupEx
verify(this.logger).debug("Updating patient record with external ID [{}] via REST", "eid");
}

@Test
public void updatePatientBlankJSONBais() throws ComponentLookupException, XWikiRestException
{
when(this.repository.getPatientByExternalId("eid")).thenReturn(this.patient);
when(this.access.hasAccess(Right.EDIT, null, null)).thenReturn(true);

Response response = this.mocker.getComponentUnderTest().updatePatient("{\"key\":\"value\"}", "eid");
}



}

0 comments on commit 5fbae30

Please sign in to comment.