@@ -154,7 +154,11 @@ public void addPrivateTouGroupWorksCorrectly() {
154
154
Response <TimeOfUseGroup > response = touService .addPrivateTimeOfUseGroup (grp );
155
155
assertEquals ("Didn't successfully add the private TOU" , Response .STATUS_SUCCESS , response .getStatus ());
156
156
157
- cleanUpPrivateTou (response .getResults ().get (0 ));
157
+ TimeOfUseGroup addedGroup = response .getResults ().get (0 );
158
+
159
+ // Make sure the returned group has a proper ID that we can use for deletion
160
+ assertNotNull ("The returned TOU group should have a touGroupId" , addedGroup .getTouGroupId ());
161
+ cleanUpPrivateTou (addedGroup );
158
162
}
159
163
160
164
@@ -223,12 +227,17 @@ private void cleanUpPrivateTou(TimeOfUseGroup grp) {
223
227
private TimeOfUseGroup getValidTouGroup () {
224
228
TimeOfUseGroup group = new TimeOfUseGroup ();
225
229
group .setTimeOfUses (new ArrayList <TimeOfUse >());
226
- group .setLseId (734L );
230
+ group .setLseId (734L );
231
+ // Explicitly set the touGroupId to null so the server assigns a new one
232
+ group .setTouGroupId (null );
227
233
228
234
TimeOfUse tou = new TimeOfUse ();
229
235
tou .setTouName ("JAVA CLIENT LIB TOU" );
230
236
tou .setTouPeriods (new ArrayList <TimeOfUsePeriod >());
231
- tou .setTouType (String .valueOf (TimeOfUseType .OFF_PEAK ));
237
+ tou .setTouType (String .valueOf (TimeOfUseType .OFF_PEAK ));
238
+ // Make sure we don't have a conflicting ID
239
+ tou .setTouId (null );
240
+ tou .setTouGroupId (null );
232
241
group .getTimeOfUses ().add (tou );
233
242
234
243
TimeOfUsePeriod period = new TimeOfUsePeriod ();
@@ -237,7 +246,10 @@ private TimeOfUseGroup getValidTouGroup() {
237
246
period .setFromHour (0 );
238
247
period .setToHour (0 );
239
248
period .setFromMinute (0 );
240
- period .setToMinute (0 );
249
+ period .setToMinute (0 );
250
+ // Make sure we don't have a conflicting ID
251
+ period .setTouPeriodId (null );
252
+ period .setTouId (null );
241
253
tou .getTouPeriods ().add (period );
242
254
243
255
return group ;
0 commit comments