@Test public void test_regularPostingAccountWithData_SuccessfullNoContent() throws Exception { final ErrorResponse expected = new ErrorResponse(); expected.setCode(ErrorCode.POSTINGACCOUNT_STILL_REFERENCED.getErrorCode()); expected.setMessage( "The posting account cannot be deleted because it is still referenced by a flow of money or a predefined flow of money!"); PostingAccount postingAccount = this.postingAccountService.getPostingAccountById( new PostingAccountID(PostingAccountTransportBuilder.POSTING_ACCOUNT1_ID)); Assert.assertNotNull(postingAccount); final ErrorResponse response = super.callUsecaseWithoutContent( "/" + PostingAccountTransportBuilder.POSTING_ACCOUNT1_ID, this.method, false, ErrorResponse.class); postingAccount = this.postingAccountService.getPostingAccountById( new PostingAccountID(PostingAccountTransportBuilder.POSTING_ACCOUNT1_ID)); Assert.assertNotNull(postingAccount); Assert.assertEquals(expected, response); }
@Test public void test_OnlyAdminAllowed_ErrorResponse() throws Exception { this.userName = UserTransportBuilder.USER1_NAME; this.userPassword = UserTransportBuilder.USER1_PASSWORD; final ErrorResponse actual = super.callUsecaseWithoutContent( "/" + PostingAccountTransportBuilder.POSTING_ACCOUNT1_ID, this.method, false, ErrorResponse.class); Assert.assertEquals(new Integer(ErrorCode.USER_IS_NO_ADMIN.getErrorCode()), actual.getCode()); }