Skip to content

Commit

Permalink
Merge pull request #31 from Sprokof/unitTest
Browse files Browse the repository at this point in the history
Add unit test for getAllDaos
  • Loading branch information
Mom0aut authored Jul 20, 2024
2 parents 15eba58 + 79e6c65 commit 4b7505c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion testing/src/test/java/at/test/drm/RelationDaoFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.context.ApplicationContext;

import java.util.Map;
import java.util.*;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -66,4 +66,13 @@ void getDaoFromSourceObjectClassShouldThrowRuntimeException() {
assertThat(exception).isNotNull();
}

@Test
void getAllDaos() {
Map<String, RelationDao> testBeansOfType = Map.ofEntries(Map.entry("testDaos", relationDao));
Mockito.when(applicationContext.getBeansOfType(any(Class.class)))
.thenReturn(Map.ofEntries(Map.entry("testDaos", relationDao)));
Set<RelationDao> actual = new HashSet<>(testBeansOfType.values());
Set<RelationDao> excepted = relationDaoFactoryUnderTest.getAllDaos();
assertThat(actual).isEqualTo(excepted);
}
}

0 comments on commit 4b7505c

Please sign in to comment.