1818
1919import java .util .Arrays ;
2020import java .util .Collections ;
21- import java .util .Date ;
2221
2322import static org .junit .Assert .assertFalse ;
2423import static org .junit .Assert .assertTrue ;
@@ -39,18 +38,17 @@ public void setup() {
3938 activeTag = new BedTag ();
4039 activeTag .setName ("ICU-1" );
4140 activeTag .setUuid ("active-uuid" );
42- activeTag .setDateVoided ( null );
41+ activeTag .setVoided ( false );
4342
4443 expiredTag = new BedTag ();
4544 expiredTag .setName ("ExpiredTag" );
4645 expiredTag .setUuid ("expired-uuid" );
47- expiredTag .setDateVoided ( new Date ( System . currentTimeMillis () - 24 * 60 * 60 * 1000 ) );
46+ expiredTag .setVoided ( true );
4847 }
4948
5049 @ Test
5150 public void validate_shouldFailIfNameIsNullOrEmptyOrWhitespace () {
5251 BedTag tag = new BedTag ();
53-
5452 tag .setName (null );
5553 Errors errors = new BindException (tag , "tag" );
5654 validator .validate (tag , errors );
@@ -126,31 +124,12 @@ public void validate_shouldRejectNonBedTagObjects() {
126124 assertTrue (errors .hasGlobalErrors ());
127125 }
128126
129- @ Test
130- public void saveBedTag_shouldInvokeValidator () {
131- BedTagValidator spyValidator = spy (new BedTagValidator (bedManagementService ));
132- BedManagementService service = mock (BedManagementService .class );
133-
134- BedTag tag = new BedTag ();
135- tag .setName ("AnotherUniqueTag" );
136-
137- doAnswer (invocation -> {
138- Errors errors = new BindException (tag , "tag" );
139- spyValidator .validate (tag , errors );
140- return null ;
141- }).when (service ).saveBedTag (tag );
142-
143- service .saveBedTag (tag );
144-
145- verify (spyValidator , times (1 )).validate (eq (tag ), any (Errors .class ));
146- }
147-
148127 @ Test
149128 public void shouldUpdateBedTag () throws Exception {
150129 BedTag existingTag = new BedTag ();
151130 existingTag .setName ("ICU-1" );
152131 existingTag .setUuid ("existing-uuid" );
153- existingTag .setDateVoided ( null );
132+ existingTag .setVoided ( false );
154133 when (bedManagementService .getAllBedTags ()).thenReturn (Arrays .asList (existingTag ));
155134
156135 BedTag tagToUpdate = new BedTag ();
0 commit comments