### Question:
ContentRestService extends RestServiceBase { protected ProviderContentTypeInfo getTypeInfoWithManagePermissionCheck(String type) throws NotAuthorizedException, BadFieldException, OperationUnavailableException { if (type == null || SearchUtils.isBlank(type)) { throw new RequiredFieldException("type"); } ProviderContentTypeInfo typeInfo = providerService.findContentType(type); if (typeInfo == null) { throw new BadFieldException("type", "content type not found"); } authenticationUtilService.checkProviderManagementPermission(typeInfo.getProviderName()); if (contentManipulationLockService.isLockedForProvider(typeInfo.getProviderName())) { throw new OperationUnavailableException("Content manipulation API is locked down by administrator"); } return typeInfo; }  @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) Object getAllContent(@PathParam("type") String type, @QueryParam("from") Integer from,
			@QueryParam("size") Integer size, @QueryParam("sort") String sort); @GET @Path("/{contentId}") @Produces(MediaType.APPLICATION_JSON) Object getContent(@PathParam("type") String type, @PathParam("contentId") String contentId); @POST @Path("/{contentId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Object pushContent(@PathParam("type") String type, @PathParam("contentId") String contentId,
			Map<String, Object> content); @POST @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Object pushContentBulk(@PathParam("type") String type, Map<String, Object> contentStructure); PushContentImplRet pushContentImpl(ProviderContentTypeInfo typeInfo, String contentId,
			Map<String, Object> content); @DELETE @Path("/{contentId}") @Audit Object deleteContent(@PathParam("type") String type, @PathParam("contentId") @AuditId String contentId,
			@QueryParam("ignore_missing") String ignoreMissing); @DELETE @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Audit Object deleteContentBulk(@PathParam("type") String type, @AuditContent Map<String, Object> content);  }### Answer:
@Test public void getTypeInfoWithManagePermissionCheck() { ContentRestService tested = getTested(false); try { tested.getTypeInfoWithManagePermissionCheck(null); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.getTypeInfoWithManagePermissionCheck(""); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.getTypeInfoWithManagePermissionCheck(" "); Assert.fail("RequiredFieldException expected"); } catch (RequiredFieldException e) { } try { tested.getTypeInfoWithManagePermissionCheck(TYPE_UNKNOWN); Assert.fail("BadFieldException expected"); } catch (BadFieldException e) { } { ProviderContentTypeInfo ret = tested.getTypeInfoWithManagePermissionCheck(TYPE_KNOWN); Assert.assertNotNull(ret); Assert.assertEquals(TYPE_KNOWN, ret.getTypeName()); Assert.assertEquals(ProviderServiceTest.TEST_PROVIDER_NAME, ret.getProviderName()); verify(tested.authenticationUtilService) .checkProviderManagementPermission(ProviderServiceTest.TEST_PROVIDER_NAME); } try { Mockito.doThrow(new NotAuthorizedException("no perm")).when(tested.authenticationUtilService) .checkProviderManagementPermission(ProviderServiceTest.TEST_PROVIDER_NAME); tested.getTypeInfoWithManagePermissionCheck(TYPE_KNOWN); Assert.fail("NotAuthorizedException expected"); } catch (NotAuthorizedException e) { } try { Mockito.doThrow(new NotAuthenticatedException(AuthenticatedUserType.PROVIDER)) .when(tested.authenticationUtilService) .checkProviderManagementPermission(ProviderServiceTest.TEST_PROVIDER_NAME); tested.getTypeInfoWithManagePermissionCheck(TYPE_KNOWN); Assert.fail("NotAuthenticatedException expected"); } catch (NotAuthenticatedException e) { } }