@Test public void testDelete() throws Exception { when(authorizeService.isAdmin(context)).thenReturn(true); entityTypeService.delete(context, entityType); Mockito.verify(entityTypeDAO,times(1)).delete(context, entityType); }
@Override public void delete(Context context,EntityType entityType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can delete entityType"); } entityTypeDAO.delete(context, entityType); }
EntityTypeServiceImpl implements EntityTypeService { @Override public void delete(Context context,EntityType entityType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can delete entityType"); } entityTypeDAO.delete(context, entityType); } }
EntityTypeServiceImpl implements EntityTypeService { @Override public void delete(Context context,EntityType entityType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can delete entityType"); } entityTypeDAO.delete(context, entityType); }  }
EntityTypeServiceImpl implements EntityTypeService { @Override public void delete(Context context,EntityType entityType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can delete entityType"); } entityTypeDAO.delete(context, entityType); }  @Override EntityType findByEntityType(Context context, String entityType); @Override List<EntityType> findAll(Context context); @Override List<EntityType> findAll(Context context, Integer limit, Integer offset); @Override EntityType create(Context context); @Override EntityType create(Context context, String entityTypeString); @Override EntityType find(Context context,int id); @Override void update(Context context,EntityType entityType); @Override void update(Context context,List<EntityType> entityTypes); @Override void delete(Context context,EntityType entityType); }
EntityTypeServiceImpl implements EntityTypeService { @Override public void delete(Context context,EntityType entityType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators can delete entityType"); } entityTypeDAO.delete(context, entityType); }  @Override EntityType findByEntityType(Context context, String entityType); @Override List<EntityType> findAll(Context context); @Override List<EntityType> findAll(Context context, Integer limit, Integer offset); @Override EntityType create(Context context); @Override EntityType create(Context context, String entityTypeString); @Override EntityType find(Context context,int id); @Override void update(Context context,EntityType entityType); @Override void update(Context context,List<EntityType> entityTypes); @Override void delete(Context context,EntityType entityType);  }