}
@Test
- public void test_getLogicLink_exception() {
+ public void test_getLogicLink_exception() throws CorrelationException {
mockGetMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
+ EasyMock.expect(response.readEntity(String.class)).andReturn("Error!");
- thrown.expect(RuntimeException.class);
+ thrown.expect(CorrelationException.class);
PowerMock.replayAll();
}
@Test
- public void test_getLogicLink() {
+ public void test_getLogicLink() throws CorrelationException {
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("logic-link"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("logic-link").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
PowerMock.replayAll();
@Test
public void test_getServiceInstances_exception() {
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("vpn-binding"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("vpn-binding").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("connectivity"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("connectivity").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instance-by-connectivity"));
+ EasyMock.expect(response.readEntity(String.class))
+ .andReturn(data.getJSONObject("service-instance-by-connectivity").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type"));
+ EasyMock.expect(response.readEntity(String.class))
+ .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
mockGetMethod();
@Test
public void test_getServiceInstances() {
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("vpn-binding"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("vpn-binding").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("connectivity"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("connectivity").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instance-by-connectivity"));
+ EasyMock.expect(response.readEntity(String.class))
+ .andReturn(data.getJSONObject("service-instance-by-connectivity").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type"));
+ EasyMock.expect(response.readEntity(String.class))
+ .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
mockGetMethod();
@Test
public void test_getServiceInstances_1() throws Exception {
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type"));
+ EasyMock.expect(response.readEntity(String.class))
+ .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString());
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
PowerMock.replayAll();
@Test
public void test_getServiceInstances_1_exception() throws Exception {
mockGetMethod();
- EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type"));
+ EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to get the service instance by type.");
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
thrown.expect(CorrelationException.class);
public void test_updateTerminalPointStatus_exception() throws CorrelationException {
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
+ EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the TP information.");
thrown.expect(CorrelationException.class);
public void test_updateLogicLinkStatus_exception() throws CorrelationException {
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
+ EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the logic link information.");
thrown.expect(CorrelationException.class);