-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
276 additions
and
18 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
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
59 changes: 59 additions & 0 deletions
59
.../test/java/com/tvd12/ezydata/database/test/bean/EzyAbstractRepositoryImplementerTest.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,59 @@ | ||
package com.tvd12.ezydata.database.test.bean; | ||
|
||
import com.tvd12.ezydata.database.EzyDatabaseRepository; | ||
import com.tvd12.ezydata.database.bean.EzyAbstractRepositoryImplementer; | ||
import com.tvd12.ezyfox.reflect.EzyMethod; | ||
import com.tvd12.test.assertion.Asserts; | ||
import com.tvd12.test.reflect.MethodInvoker; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class EzyAbstractRepositoryImplementerTest { | ||
|
||
@Test | ||
public void isAutoImplementMethodTest() throws Exception { | ||
// given | ||
ExEzyRepositoryImplementer instance = new ExEzyRepositoryImplementer( | ||
ExRepo.class | ||
); | ||
|
||
// when | ||
boolean answer = MethodInvoker.create() | ||
.object(instance) | ||
.method("isAutoImplementMethod") | ||
.param( | ||
EzyMethod.class, | ||
new EzyMethod( | ||
ExRepo.class.getDeclaredMethod("findAll") | ||
) | ||
) | ||
.invoke(Boolean.class); | ||
|
||
// then | ||
Asserts.assertFalse(answer); | ||
} | ||
|
||
public static class ExEzyRepositoryImplementer | ||
extends EzyAbstractRepositoryImplementer { | ||
|
||
public ExEzyRepositoryImplementer(Class<?> clazz) { | ||
super(clazz); | ||
} | ||
|
||
@Override | ||
protected Class<?> getSuperClass() { | ||
return EzyDatabaseRepository.class; | ||
} | ||
} | ||
|
||
public interface ExRepo | ||
extends EzyDatabaseRepository<Long, Person> { | ||
|
||
@Override | ||
default List<Person> findAll() { | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.