Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Latest commit

 

History

History
25 lines (19 loc) · 963 Bytes

File metadata and controls

25 lines (19 loc) · 963 Bytes

Code style

Tests

  • Class naming: unit tests - {ClassUnderTest}UnitTest, persistence tests - {ClassUnderTest}PersistenceTest, integration tests - {ClassUnderTest}IntegrationTest
  • Method naming: [unitOfWork_stateUnderTest_expectedBehavior], read more...
  • Code layout: given-when-then pattern a.k.a. Arrange-Act-Assert
  • Assertions: Hamcrest library
 @Test
 public void sum_simpleValues_calculated() {
     
   // given  
   Calculator calculator = new Calculator();

   // when 
   int sum = calculator.sum(1, 3);
   
   // then
   assertThat(sum, is(4));
 }