package com.epam.rft.atsy.persistence.repositories;


import com.epam.rft.atsy.persistence.entities.ApplicationEntity;
import com.epam.rft.atsy.persistence.entities.CandidateEntity;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;

import java.util.List;

@Sql("classpath:sql/application/application.sql")
public class ApplicationsRepositoryIT extends AbstractRepositoryIT {

    @Autowired
    private ApplicationsRepository repository;

    @Autowired
    private CandidateRepository candidateRepository;

    @Test
    public void findByCandidateEntityShouldNotFindCandidatesByUnknownCandidate() {

        CandidateEntity candidate = this.candidateRepository.findOne(2L);
        List<ApplicationEntity> result = this.repository.findByCandidateEntity(candidate);

        Assert.assertNotNull(result);
        Assert.assertTrue(result.isEmpty());
    }

}

@@ -179,33 +179,8 @@
 ty;%0A
-import org.junit.Assert;%0A
 impo
@@ -336,16 +336,153 @@
 .List;%0A%0A
+import static org.hamcrest.CoreMatchers.notNullValue;%0Aimport static org.hamcrest.Matchers.*;%0Aimport static org.junit.Assert.assertThat;%0A%0A
 @Sql(%22cl
@@ -589,24 +589,75 @@
 sitoryIT %7B%0A%0A
+    public static final long CANDIDATE_B_ID = 2L;%0A%0A
     @Autowir
@@ -840,41 +840,71 @@
 Find
-CandidatesByUnknownCandidate() %7B%0A
+ApplicationForCandidateWithoutApplications() %7B%0A        // Given
 %0A   
@@ -933,16 +933,17 @@
 andidate
+B
  = this.
@@ -974,12 +974,41 @@
 One(
-2L);
+CANDIDATE_B_ID);%0A%0A        // When
 %0A   
@@ -1092,16 +1092,17 @@
 andidate
+B
 );%0A%0A    
@@ -1109,35 +1109,57 @@
     
-Assert.assertNotNull(result
+// Then%0A        assertThat(result, notNullValue()
 );%0A 
@@ -1169,36 +1169,28 @@
     
-A
+a
 ssert
-.assertTrue
+That
 (result
-.isE
+, e
 mpty

clean up application repository integration test case