-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore+refacto(jpa) add mapstruct + fix jpa repo to have a spring cont…
…ext ok
- Loading branch information
mpumd
committed
Oct 9, 2024
1 parent
7110e9a
commit 283a341
Showing
10 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...spring/sb-application/src/main/java/com/mpumd/poc/person/sb/application/PersonAppSvc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...ng/sb-application/src/test/java/com/mpumd/poc/person/sb/application/PersonAppSvcTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.mpumd.poc.person.sb.application; | ||
|
||
import com.mpumd.poc.person.application.PersonApplicationService; | ||
import com.mpumd.poc.person.context.PersonPersistanceRepository; | ||
import com.mpumd.poc.person.context.command.PersonRegistrationCommand; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.ArgumentCaptor; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.Spy; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.doNothing; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class PersonAppSvcTest { | ||
|
||
@Mock | ||
PersonPersistanceRepository persistanceRepository; | ||
|
||
@InjectMocks | ||
@Spy | ||
PersonAppSvc personAppSvc; | ||
|
||
@Mock | ||
PersonRegistrationCommand cmd; | ||
|
||
@Test | ||
void shouldCallSuperRegister() { | ||
var captor = ArgumentCaptor.forClass(PersonRegistrationCommand.class); | ||
doNothing().when((PersonApplicationService)personAppSvc).register(captor.capture()); | ||
|
||
personAppSvc.register(cmd); | ||
|
||
assertEquals(captor.getValue(), cmd); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
infra-spring/sb-out/src/main/java/com/mpumd/poc/person/sb/jpa/JpaConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mpumd.poc.person.sb.jpa; | ||
|
||
// optional at this moment | ||
//@EnableJpaRepositories(basePackages = "com.mpumd.poc.person.sb.jpa") | ||
//@EntityScan("com.mpumd.poc.person.sb.jpa.entity") | ||
public class JpaConfig { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
infra-spring/sb-out/src/main/java/com/mpumd/poc/person/sb/jpa/PersonSpringRepo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.mpumd.poc.person.sb.jpa; | ||
|
||
import com.mpumd.poc.person.sb.jpa.entity.PersonEntity; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface PersonSpringRepo extends CrudRepository<PersonEntity, UUID> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
infra-spring/sb-out/src/test/java/com/mpumd/poc/person/sb/jpa/PersonJpaAdapterIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mpumd.poc.person.sb.jpa; | ||
|
||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
||
@DataJpaTest | ||
@Disabled | ||
class PersonJpaAdapterIT { | ||
|
||
@Test | ||
void shouldPushInDB() { | ||
} | ||
} |