-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JUnit Test Framework: unify Dummy components (#2421)
- Loading branch information
1 parent
fb6d1dd
commit 18bfe03
Showing
65 changed files
with
1,252 additions
and
1,726 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
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
177 changes: 177 additions & 0 deletions
177
io.openems.edge.battery.api/src/io/openems/edge/battery/test/AbstractDummyBattery.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,177 @@ | ||
package io.openems.edge.battery.test; | ||
|
||
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; | ||
import io.openems.edge.battery.api.Battery; | ||
import io.openems.edge.common.startstop.StartStop; | ||
import io.openems.edge.common.startstop.StartStoppable; | ||
import io.openems.edge.common.test.AbstractDummyOpenemsComponent; | ||
import io.openems.edge.common.test.TestUtils; | ||
|
||
public abstract class AbstractDummyBattery<SELF extends AbstractDummyBattery<?>> | ||
extends AbstractDummyOpenemsComponent<SELF> implements Battery, StartStoppable { | ||
|
||
protected AbstractDummyBattery(String id, io.openems.edge.common.channel.ChannelId[] firstInitialChannelIds, | ||
io.openems.edge.common.channel.ChannelId[]... furtherInitialChannelIds) { | ||
super(id, firstInitialChannelIds, furtherInitialChannelIds); | ||
} | ||
|
||
@Override | ||
public final void setStartStop(StartStop value) throws OpenemsNamedException { | ||
this.withStartStop(value); | ||
} | ||
|
||
/** | ||
* Set {@link StartStoppable.ChannelId#START_STOP}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withStartStop(StartStop value) { | ||
TestUtils.withValue(this, StartStoppable.ChannelId.START_STOP, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#SOC}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withSoc(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.SOC, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#SOH}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withSoh(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.SOH, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#CAPACITY}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withCapacity(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.CAPACITY, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#VOLTAGE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withVoltage(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.VOLTAGE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#CURRENT}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withCurrent(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.CURRENT, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#DISCHARGE_MAX_CURRENT}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withDischargeMaxCurrent(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.DISCHARGE_MAX_CURRENT, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#CHARGE_MAX_CURRENT}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withChargeMaxCurrent(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.CHARGE_MAX_CURRENT, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#DISCHARGE_MIN_VOLTAGE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withDischargeMinVoltage(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.DISCHARGE_MIN_VOLTAGE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#CHARGE_MAX_VOLTAGE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withChargeMaxVoltage(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.CHARGE_MAX_VOLTAGE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#MIN_CELL_VOLTAGE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withMinCellVoltage(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.MIN_CELL_VOLTAGE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#MAX_CELL_VOLTAGE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withMaxCellVoltage(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.MAX_CELL_VOLTAGE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#MIN_CELL_TEMPERATURE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withMinCellTemperature(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.MIN_CELL_TEMPERATURE, value); | ||
return this.self(); | ||
} | ||
|
||
/** | ||
* Set {@link Battery.ChannelId#MAX_CELL_TEMPERATURE}. | ||
* | ||
* @param value the value | ||
* @return myself | ||
*/ | ||
public final SELF withMaxCellTemperature(int value) { | ||
TestUtils.withValue(this, Battery.ChannelId.MAX_CELL_TEMPERATURE, value); | ||
return this.self(); | ||
} | ||
|
||
} |
Oops, something went wrong.