-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
See also PR #339
- Loading branch information
Showing
2 changed files
with
50 additions
and
6 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
49 changes: 49 additions & 0 deletions
49
...urces/core/src/test/java/__packageInPathFormat__/general/common/base/ApplicationTest.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,49 @@ | ||
package ${package}.general.common.base; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.devonfw.module.basic.common.api.to.AbstractEto; | ||
import com.devonfw.module.beanmapping.common.api.BeanMapper; | ||
|
||
import ${package}.general.common.base.test.ApplicationComponentTest; | ||
import ${package}.general.dataaccess.api.ApplicationPersistenceEntity; | ||
|
||
/** | ||
* This test verifies that {@link ${package}.SpringBootApp} is able to startup. | ||
*/ | ||
public class ApplicationTest extends ApplicationComponentTest { | ||
|
||
@Inject | ||
private BeanMapper beanMapper; | ||
|
||
/** Test that {@link it.pkg.SpringBootApp} is able to startup. */ | ||
@Test | ||
public void testContextLoads() { | ||
|
||
// given | ||
Long id = Long.valueOf(4711); | ||
MyEntity entity = new MyEntity(); | ||
entity.setId(id); | ||
// when | ||
MyEto eto = this.beanMapper.map(entity, MyEto.class); | ||
// then | ||
assertThat(eto.getId()).isEqualTo(id); | ||
assertThat(eto.getModificationCounter()).isEqualTo(0); | ||
// and when | ||
entity.setModificationCounter(5); | ||
// then | ||
assertThat(eto.getModificationCounter()).isEqualTo(5); | ||
} | ||
|
||
/** Dummy entity for testing. */ | ||
public static class MyEntity extends ApplicationPersistenceEntity { | ||
private static final long serialVersionUID = 1L; | ||
} | ||
|
||
/** Dummy ETO for testing. */ | ||
public static class MyEto extends AbstractEto { | ||
private static final long serialVersionUID = 1L; | ||
} | ||
} |