1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.api.di.testing;
20
21 import java.io.File;
22
23 import org.apache.maven.api.Session;
24 import org.apache.maven.api.di.Inject;
25 import org.apache.maven.api.di.Provides;
26 import org.apache.maven.api.plugin.testing.stubs.SessionMock;
27 import org.junit.jupiter.api.Test;
28
29 import static org.apache.maven.api.di.testing.MavenDIExtension.getBasedir;
30 import static org.junit.jupiter.api.Assertions.assertNotNull;
31
32 @MavenDITest
33 public class SimpleDITest {
34
35 private static final String LOCAL_REPO = getBasedir() + File.separator + "target" + File.separator + "local-repo";
36
37 @Inject
38 Session session;
39
40 @Test
41 void testSession() {
42 assertNotNull(session);
43 assertNotNull(session.getLocalRepository());
44 }
45
46 @Provides
47 Session createSession() {
48 return SessionMock.getMockSession(LOCAL_REPO);
49 }
50 }