1+ package $ {package }.general .common .base ;
2+
3+ import javax .inject .Inject ;
4+
5+ import org .junit .jupiter .api .Test ;
6+
7+ import com .devonfw .module .basic .common .api .to .AbstractEto ;
8+ import com .devonfw .module .beanmapping .common .api .BeanMapper ;
9+
10+ import $ {package }.general .common .base .test .ApplicationComponentTest ;
11+ import $ {package }.general .dataaccess .api .ApplicationPersistenceEntity ;
12+
13+ /**
14+ * This test verifies that {@link ${package}.SpringBootApp} is able to startup.
15+ */
16+ public class ApplicationTest extends ApplicationComponentTest {
17+
18+ @ Inject
19+ private BeanMapper beanMapper ;
20+
21+ /** Test that {@link it.pkg.SpringBootApp} is able to startup. */
22+ @ Test
23+ public void testContextLoads () {
24+
25+ // given
26+ Long id = Long .valueOf (4711 );
27+ MyEntity entity = new MyEntity ();
28+ entity .setId (id );
29+ // when
30+ MyEto eto = this .beanMapper .map (entity , MyEto .class );
31+ // then
32+ assertThat (eto .getId ()).isEqualTo (id );
33+ assertThat (eto .getModificationCounter ()).isEqualTo (0 );
34+ // and when
35+ entity .setModificationCounter (5 );
36+ // then
37+ assertThat (eto .getModificationCounter ()).isEqualTo (5 );
38+ }
39+
40+ /** Dummy entity for testing. */
41+ public static class MyEntity extends ApplicationPersistenceEntity {
42+ private static final long serialVersionUID = 1L ;
43+ }
44+
45+ /** Dummy ETO for testing. */
46+ public static class MyEto extends AbstractEto {
47+ private static final long serialVersionUID = 1L ;
48+ }
49+ }
0 commit comments