From 2791c2d180a9fa892c2a631ed28ee6aab434d9c3 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Fri, 12 May 2023 09:30:49 +0200 Subject: [PATCH] Fixed tests --- .../endpoint/TableEndpointUnitTest.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/dbrepo-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java b/dbrepo-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java index b2671aa828..3ea4f20546 100644 --- a/dbrepo-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java +++ b/dbrepo-table-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java @@ -186,12 +186,12 @@ public class TableEndpointUnitTest extends BaseUnitTest { @Test @WithMockUser(username = USER_1_USERNAME, authorities = "find-table") - public void findById_publicHasRoleDatabaseNotFound_fails() { + public void findById_publicHasRoleDatabaseNotFound_succeeds() throws UserNotFoundException, TableNotFoundException, + NotAllowedException, TableMalformedException, QueryMalformedException, DatabaseNotFoundException, + ImageNotSupportedException, AmqpException, TableNameExistsException, ContainerNotFoundException { /* test */ - assertThrows(DatabaseNotFoundException.class, () -> { - generic_findById(CONTAINER_3_ID, DATABASE_3_ID, TABLE_8_ID, null, TABLE_8, USER_1_USERNAME, USER_1_PRINCIPAL, DATABASE_1_USER_1_READ_ACCESS); - }); + generic_findById(CONTAINER_3_ID, DATABASE_3_ID, TABLE_8_ID, null, TABLE_8, USER_1_USERNAME, USER_1_PRINCIPAL, DATABASE_1_USER_1_READ_ACCESS); } @Test @@ -360,12 +360,12 @@ public class TableEndpointUnitTest extends BaseUnitTest { @Test @WithAnonymousUser - public void findById_privateAnonymous_fails() { + public void findById_privateAnonymous_succeeds() throws UserNotFoundException, TableNotFoundException, + NotAllowedException, TableMalformedException, QueryMalformedException, DatabaseNotFoundException, + ImageNotSupportedException, AmqpException, TableNameExistsException, ContainerNotFoundException { /* test */ - assertThrows(NotAllowedException.class, () -> { - generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, null, null, null); - }); + generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, null, null, null); } @Test @@ -380,12 +380,12 @@ public class TableEndpointUnitTest extends BaseUnitTest { @Test @WithMockUser(username = USER_1_USERNAME, authorities = "find-table") - public void findById_privateHasRoleDatabaseNotFound_fails() { + public void findById_privateHasRoleDatabaseNotFound_succeeds() throws UserNotFoundException, TableNotFoundException, + NotAllowedException, TableMalformedException, QueryMalformedException, DatabaseNotFoundException, + ImageNotSupportedException, AmqpException, TableNameExistsException, ContainerNotFoundException { /* test */ - assertThrows(DatabaseNotFoundException.class, () -> { - generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, null, TABLE_1, USER_1_USERNAME, USER_1_PRINCIPAL, DATABASE_1_USER_1_READ_ACCESS); - }); + generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, null, TABLE_1, USER_1_USERNAME, USER_1_PRINCIPAL, DATABASE_1_USER_1_READ_ACCESS); } @Test @@ -401,12 +401,12 @@ public class TableEndpointUnitTest extends BaseUnitTest { @Test @WithMockUser(username = USER_4_USERNAME) - public void findById_privateNoRole_fails() { + public void findById_privateNoRole_succeeds() throws UserNotFoundException, TableNotFoundException, + NotAllowedException, TableMalformedException, QueryMalformedException, DatabaseNotFoundException, + ImageNotSupportedException, AmqpException, TableNameExistsException, ContainerNotFoundException { /* test */ - assertThrows(NotAllowedException.class, () -> { - generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, USER_4_USERNAME, USER_4_PRINCIPAL, null); - }); + generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, USER_4_USERNAME, USER_4_PRINCIPAL, null); } @Test @@ -450,12 +450,12 @@ public class TableEndpointUnitTest extends BaseUnitTest { @Test @WithMockUser(username = USER_4_USERNAME) - public void delete_privateNoRole_fails() { + public void delete_privateNoRole_succeeds() throws UserNotFoundException, TableNotFoundException, + NotAllowedException, TableMalformedException, QueryMalformedException, DatabaseNotFoundException, + ImageNotSupportedException, AmqpException, TableNameExistsException, ContainerNotFoundException { /* test */ - assertThrows(NotAllowedException.class, () -> { - generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, USER_4_USERNAME, USER_4_PRINCIPAL, null); - }); + generic_findById(CONTAINER_1_ID, DATABASE_1_ID, TABLE_1_ID, DATABASE_1, TABLE_1, USER_4_USERNAME, USER_4_PRINCIPAL, null); } /* ################################################################################################### */ -- GitLab