Skip to content

Commit 445a744

Browse files
authored
Merge pull request #201 from ubitricity/master
Allow listVersion 0 in SendLocalListRequest
2 parents 9781c1f + 5434490 commit 445a744

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515

1616
allprojects {
1717
group = 'eu.chargetime.ocpp'
18-
version = '1.0.2'
18+
version = '1.1'
1919
}
2020

2121
subprojects {

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/localauthlist/SendLocalListRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public Integer getListVersion() {
7474
* @param listVersion, the version number of the list
7575
*/
7676
public void setListVersion(Integer listVersion) {
77-
if (listVersion < 1) {
78-
throw new PropertyConstraintException(listVersion, "listVersion must be > 0");
77+
if (listVersion < 0) {
78+
throw new PropertyConstraintException(listVersion, "listVersion must be >= 0");
7979
}
8080
this.listVersion = listVersion;
8181
}
@@ -122,7 +122,7 @@ public void setUpdateType(UpdateType updateType) {
122122

123123
@Override
124124
public boolean validate() {
125-
boolean valid = listVersion != null && (listVersion >= 1) && (updateType != null);
125+
boolean valid = listVersion != null && (listVersion >= 0) && (updateType != null);
126126

127127
if (localAuthorizationList != null) {
128128
for (AuthorizationData data : localAuthorizationList) {

ocpp-v1_6/src/test/java/eu/chargetime/ocpp/model/localauthlist/test/SendLocalListRequestTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,23 @@ public void setUp() {
3838

3939
@Test
4040
public void setListVersion_asNegative_throwsPropertyConstraintException() {
41-
testInvalidListVersion(-20);
42-
}
43-
44-
@Test
45-
public void setListVersion_asZero_throwsPropertyConstraintException() {
46-
testInvalidListVersion(0);
41+
testInvalidListVersion(-1);
4742
}
4843

4944
private void testInvalidListVersion(int invalidVersion) {
5045
thrownException.expect(instanceOf(PropertyConstraintException.class));
5146
thrownException.expectMessage(
5247
equalTo(
53-
"Validation failed: [listVersion must be > 0]. Current Value: ["
48+
"Validation failed: [listVersion must be >= 0]. Current Value: ["
5449
+ invalidVersion
5550
+ "]"));
5651

5752
request.setListVersion(invalidVersion);
5853
}
5954

6055
@Test
61-
public void setListVersion_isNonZeroPostive_isCorrect() {
62-
for (int i = 1; i <= 10; i++) {
56+
public void setListVersion_isNotNegative_isCorrect() {
57+
for (int i = 0; i <= 10; i++) {
6358
// When
6459
request.setListVersion(i);
6560
// Then

0 commit comments

Comments
 (0)