File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
app/src/test/java/com/d4rk/androidtutorials/java/domain/android Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .d4rk .androidtutorials .java .domain .android ;
2+
3+ import static org .junit .Assert .assertSame ;
4+ import static org .mockito .Mockito .mock ;
5+ import static org .mockito .Mockito .verify ;
6+ import static org .mockito .Mockito .when ;
7+
8+ import com .d4rk .androidtutorials .java .data .repository .LessonRepository ;
9+
10+ import org .junit .Test ;
11+
12+ public class GetLessonUseCaseTest {
13+
14+ @ Test
15+ public void invokeReturnsLesson () {
16+ LessonRepository repository = mock (LessonRepository .class );
17+ LessonRepository .Lesson lesson = new LessonRepository .Lesson (1 , 2 , 3 );
18+ when (repository .getLesson ("intro" )).thenReturn (lesson );
19+ GetLessonUseCase useCase = new GetLessonUseCase (repository );
20+
21+ LessonRepository .Lesson result = useCase .invoke ("intro" );
22+
23+ assertSame (lesson , result );
24+ verify (repository ).getLesson ("intro" );
25+ }
26+ }
27+
You can’t perform that action at this time.
0 commit comments