コード例 #1
0
 @Test(expected = NullPointerException.class)
 public void saveDocumentoTemporalFailsIfNotTipo() throws Exception {
   Documento documento = stubDocumento();
   documento.tipo = null;
   InputStream is = new ByteArrayInputStream("".getBytes());
   gestorDocumentalService.saveDocumentoTemporal(documento, is, TEST_FILENAME);
 }
コード例 #2
0
 @Test(expected = GestorDocumentalServiceException.class)
 public void saveDocumentoTemporalFailsIfUri() throws Exception {
   Documento documento = stubDocumento();
   documento.uri = "uri ya seteada";
   InputStream is = new ByteArrayInputStream("contenido".getBytes());
   gestorDocumentalService.saveDocumentoTemporal(documento, is, TEST_FILENAME);
 }
コード例 #3
0
 @Test
 public void saveDocumentoTemporalByFile() throws Exception {
   Documento documento = stubDocumento();
   File f = Play.getVirtualFile("/test/services/aedTest.txt").getRealFile();
   String uri = gestorDocumentalService.saveDocumentoTemporal(documento, f);
   assertSubidaDocumentoCorrecta(documento, uri);
 }
コード例 #4
0
 @Test(expected = IllegalArgumentException.class)
 public void saveDocumentoTemporalFailsIfOtrosAndEmptyDescripcion() throws Exception {
   Documento documento = new Documento();
   documento.tipo = getTipoDocumentoValido();
   documento.descripcion = "";
   InputStream is = new ByteArrayInputStream("".getBytes());
   gestorDocumentalService.saveDocumentoTemporal(documento, is, TEST_FILENAME);
 }
コード例 #5
0
  @Test
  public void saveDocumentoTemporal() throws Exception {
    InputStream is = new ByteArrayInputStream(TEST_FILE_CONTENT.getBytes());

    Documento documento = stubDocumento();

    String uri = gestorDocumentalService.saveDocumentoTemporal(documento, is, TEST_FILENAME);
    assertSubidaDocumentoCorrecta(documento, uri);
  }
コード例 #6
0
 private Documento saveTmpDocumento(String fileContent, String filename) throws Exception {
   InputStream is = new ByteArrayInputStream(fileContent.getBytes());
   Documento documento = stubDocumento();
   gestorDocumentalService.saveDocumentoTemporal(documento, is, filename);
   return documento;
 }
コード例 #7
0
 @Test(expected = NullPointerException.class)
 public void saveDocumentoTemporalFailsIfNullStream() throws Exception {
   Documento documento = stubDocumento();
   gestorDocumentalService.saveDocumentoTemporal(documento, null, TEST_FILENAME);
 }
コード例 #8
0
 @Test(expected = GestorDocumentalServiceException.class)
 public void saveDocumentoTemporalFailsIfEmptyStream() throws Exception {
   Documento documento = stubDocumento();
   InputStream is = new ByteArrayInputStream("".getBytes());
   gestorDocumentalService.saveDocumentoTemporal(documento, is, TEST_FILENAME);
 }