Skip to content

Commit

Permalink
virtual fields coverage in Junit4ModelGenerator/Junit5ModelGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Mar 12, 2024
1 parent 5758487 commit f78cc49
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Fixed

- virtual fields coverage in Junit4ModelGenerator/Junit5ModelGenerator

## [1.7.8] - 2024-03-12

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static void createSampleEntityInstanceMethod( DaogenBasicGenerator gen,
if ( checkIsEmpty ) {
gen.getWriter().println( DaogenBasicGenerator.TAB_2+assertionClass+".assertTrue( current.isEmpty() );" );
}
for ( DaogenCatalogField field : gen.getCurrentEntity() ) {
for ( DaogenCatalogField field : gen.getCurrentEntity().getAllFields() ) {
handleFieldNewInstance( gen.getDaogenConfig(), field, gen.getWriter() );
if ( checkIsEmpty ) {
gen.getWriter().println( DaogenBasicGenerator.TAB_2+assertionClass+".assertFalse( current.isEmpty() );" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<field comments="" id="DATE_INSERT" javaType="java.sql.Timestamp" nullable="yes" size="0" sqlType="93" sqlTypeName="TIMESTAMP"/>
<field comments="" id="DATE_UPDATE" javaType="java.sql.Timestamp" nullable="yes" size="0" sqlType="93" sqlTypeName="TIMESTAMP"/>
<field comments="1 active, 0 not active" id="STATE" javaType="java.lang.Integer" nullable="no" size="0" sqlType="4" sqlTypeName="INTEGER"/>
<field virtual="true" comments="1 active, 0 not active" id="STATE_VIRTUAL" javaType="java.lang.Integer" nullable="no" size="0" sqlType="4" sqlTypeName="INTEGER"/>
</entity>
<entity catalog="PUBLIC" comments="Contains addresses data" foreignKeys="PUBLIC.FUGERIT.USER" id="PUBLIC.FUGERIT.ADDRESS" name="ADDRESS" primaryKey="ID" schema="FUGERIT">
<field comments="Address system id" id="ID" javaType="java.lang.Long" nullable="no" size="0" sqlType="-5" sqlTypeName="BIGINT"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,22 @@ public interface ModelUser extends org.fugerit.java.core.lang.compare.CheckEmpty
*/
void setState( java.math.BigDecimal value );

/**
* Getter method for property : stateVirtual (nullable: no)
*
* 1 active, 0 not active
*
* @return the value of stateVirtual
*/
java.math.BigDecimal getStateVirtual();

/**
* Setter method for property : stateVirtual (nullable: no)
*
* 1 active, 0 not active
*
* @param value the value of stateVirtual
*/
void setStateVirtual( java.math.BigDecimal value );

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ public java.math.BigDecimal getState() {
return this.state;
}

private java.math.BigDecimal stateVirtual;

@Override
public void setStateVirtual( java.math.BigDecimal value ) {
this.stateVirtual = value;
}

@Override
public java.math.BigDecimal getStateVirtual() {
return this.stateVirtual;
}

@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
Expand All @@ -156,6 +168,8 @@ public String toString() {
buffer.append( this.getDateUpdate() );
buffer.append( ",state=" );
buffer.append( this.getState() );
buffer.append( ",stateVirtual=" );
buffer.append( this.getStateVirtual() );
buffer.append( "]" );
return buffer.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ public java.math.BigDecimal getState() {
return this.unwrapModel().getState();
}

@Override
public void setStateVirtual( java.math.BigDecimal value ) {
this.unwrapModel().setStateVirtual( value );
}

@Override
public java.math.BigDecimal getStateVirtual() {
return this.unwrapModel().getStateVirtual();
}

@Override
public boolean isEmpty() {
return this.unwrapModel().isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public ModelUser newInstance() {
Assert.assertFalse( current.isEmpty() );
current.setState(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
current.setStateVirtual(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
current.setUserAddresses( new java.util.ArrayList<org.fugerit.java.daogen.sample.def.model.ModelAddress>() );
logger.info( "unwrap : {}", current.unwrap( current ) );
return current;
Expand Down

0 comments on commit f78cc49

Please sign in to comment.