assertEquals(500, result.getStatus());
}
+ @Test
+ public void testVtpGetTestsFailure2() throws Exception {
+ new MockUp<OpenRemoteCli>() {
+
+ @Mock
+ public Result run(String[] args) throws Exception {
+ throw new Exception();
+ }
+ };
+
+ Response result = vtpResource.listTests();
+ assertEquals(500, result.getStatus());
+ }
+
@Test
public void testVtpRunTests() throws Exception {
new MockUp<OpenRemoteCli>() {
Response result = vtpResource.runTest("csar-validate", (HttpServletRequest) mockReq.getMockInstance());
assertEquals(500, result.getStatus());
}
+
+ @Test
+ public void testVtpRunTestsFailure2() throws Exception {
+ new MockUp<OpenRemoteCli>() {
+
+ @Mock
+ public Result run(String[] args) throws Exception {
+ throw new Exception();
+ }
+ };
+
+ MockUp mockReq = new MockUp<HttpServletRequest>() {
+
+ @Mock
+ public ServletInputStream getInputStream() throws IOException {
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
+ "{\"csar\"=\"VoLTE.csar\"}".getBytes());
+
+ return new ServletInputStream(){
+ public int read() throws IOException {
+ return byteArrayInputStream.read();
+ }
+
+ @Override
+ public boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setReadListener(ReadListener arg0) {
+ }
+ };
+ }
+
+ };
+
+ Response result = vtpResource.runTest("csar-validate", (HttpServletRequest) mockReq.getMockInstance());
+ assertEquals(500, result.getStatus());
+ }
}