BlogProgramming on the Toilet

PoT Episode #7: JUnits 4, 5 and Contextual Components

By September 16, 2019 No Comments

What is it?

Programming on the Toilet is a document which contains tips, tricks, snippets or explanations about various programming technologies and paradigms, which could help developers in their everyday job. This episode was brought to you by Kenan Klisura, Lead Software Engineer at Atlantbh.

JUnit5 vs JUnit4

JUnit5 is a successor of the JUnit4 testing framework. JUnit5 introduces some notable new features:

-Changes to annotations (JUnit4 -> JUnit5):

– Tags for tagging and filtering via   annotation

– Parameterized tests with   annotation and a arguments source ( , , ,  )

– Repeated tests with   annotation

– Dynamic tests – Tests generated via the factory method annotated with

Contextual Components

When using component-based architecture in the frontend, contextual components are wrapper components. They can act either as presentational or container components with an extended capability of passing a data up via yield functionality. One example, in Ember, would be a checkbox list:

// components/ui-checkbox-list.hbs (component template)
{{#each items as |item|}}
   {{yield item}}

// Usage in other parts of the application
{{ui-checkbox-list items=_checkboxItems as |item|}}
{{ui-checkbox-item item=item}}

Want to share these tips in your workplace or at home? Download this episode of Programming on the Toilet here .