When you are looking at stocks worth committing to for a long time, it's usually a good idea to have a high degree of confidence in the company's underlying earnings drivers. The four stocks outlined below have significantly different long-term trends guiding their prospects, but each of the trends is already in place.

A truly global player
In the case of Walgreens Boots Alliance (WBA -0.23%), investors are betting on a number of positive market trends. An aging demographic in the Western world promises good long-term prospects for pharmacies. A larger number of older people are living longer and carrying indications that require ongoing treatment such as diabetes or rheumatoid arthritis. This means that the company's aim of becoming a "community pharmacy" is based on strong logic.

Moreover, despite ballooning government deficits that threaten any business relying on public expenditures in the long term, I'm willing to bet on the idea that healthcare expenditure -- public or private -- is likely going to be the least resistant to cutbacks.

However, it isn't just about demographics. In fact, the company is embarking on an aggressive multi-year transformation as it builds scale through the combination of Boots and Alliance Healthcare. The businesses are complementary on a geographic basis, and allow the company to generate significant cost synergies. Indeed, the company is on track to deliver $1 billion in net synergies by the end of 2016. More on the company in a more detailed write up linked.

Management intends to expand its front-store operations -- not least through selling Alliance Boots health and beauty products and utilizing a long-term deal with AmerisourceBergen in order to ensure efficient distribution of products to its pharmacies.

Animal healthcare play
The second healthcare company, Idexx Laboratories (IDXX -0.09%), is less well known, and in this case, it's animal health. Idexx claims to be "the global leader in diagnostics and information technology solutions for animal health and water and milk quality." However, it's real growth prospects lie in its Companion Animal Group, responsible for more than 80% of revenue.

The long-term story here is one of demographics and cultural changes leading to increased expenditures on companion animals. For example, data from the American Pet Products Association demonstrates that spending on pets has risen at an average of more than 5% per annum during the last 10 years. Furthermore, as you can see in the chart below, spending on pets actually grew during the last recession -- indicating that it's a recession-proof industry.

Source: American Pet Products Association.

Idexx's management said that it sees U.S. Veterinary and Pet spending increasing at a compound annual growth rate of 6.5% from 2014-2020 when discussing a "long-term double digit organic growth opportunity."

Consolidating a fragmented industry
The industrial supply industry is characterized by a vast number of small players holding a microscopic share of the marketplace. For example, as outlined previously, according to MSC Industrial Supply (MSM 0.37%), the top 50 companies only make up 30% of the U.S. marketplace. In a sense, it's not surprising because small supply companies are often set up to serve local industrial companies, often with their own specific niche.

MSC Industrial's growth opportunity is via consolidating the industry through scaling up in order to service national customers. The company is doing this, but as I've written previously, it's suffering some near-term margin erosion in the process. In addition, its prospects will always be largely tied to fortunes in the U.S. industrial sector. However, if you believe in the idea of a U.S. industrial renaissance, then MSC Industrial is well positioned to grow.

Me too growth
Cognex Corporation
(CGNX -1.33%) specializes in machine vision solutions that help companies monitor and manage automated processes. The automotive industry is known for being an early adopter of manufacturing technology and, as such, constitutes Cognex's core marketplace.

Cognex's management has been busy expanding its total addressable market through expansion into other industry verticals, such as food, logistics, and consumer electronics. The growth opportunity comes from other industries and emerging market manufacturers starting to adopt its technology in order to improve the efficiency of their automated manufacturing.

However, no growth company expands without some teething problems, and the recent results were disappointing. In short, management failed to sign deals they were expecting to complete. No matter; if you believe in the long-term story, then Cognex has plenty of time to grow.

The takeaway
Taking a balanced view, Walgreen offers the benefits of scale and globalization, but it also carries some political risk. MSC Industrial is suffering some near-term margin decline, and you need to believe in the long-term future of U.S. manufacturing in order to confidently buy the stock.

Cognex is attractive, but don't buy it if you can't tolerate volatility. And finally, Idexx operates in competitive markets, and there is no guarantee its diagnostics solutions will retain their market position.

With that said, all four companies look well placed within their industries, and are worth a good look for long-term investors.