2323import static org .junit .Assert .assertNotNull ;
2424import static org .junit .Assert .assertNull ;
2525
26+ import com .google .cloud .Timestamp ;
2627import com .google .cloud .datastore .Cursor ;
2728import com .google .cloud .datastore .Datastore ;
2829import com .google .cloud .datastore .DatastoreException ;
29- import com .google .cloud .datastore .DateTime ;
3030import com .google .cloud .datastore .Entity ;
3131import com .google .cloud .datastore .EntityQuery ;
3232import com .google .cloud .datastore .FullEntity ;
5151import com .google .common .collect .ImmutableSet ;
5252import com .google .common .collect .Iterators ;
5353
54- import org .joda .time .Duration ;
5554import org .junit .AfterClass ;
5655import org .junit .Before ;
5756import org .junit .BeforeClass ;
6059import org .junit .rules .ExpectedException ;
6160import org .junit .runner .RunWith ;
6261import org .junit .runners .JUnit4 ;
62+ import org .threeten .bp .Duration ;
6363
6464import java .io .IOException ;
6565import java .util .ArrayList ;
@@ -88,9 +88,9 @@ public class ConceptsTest {
8888 private KeyFactory keyFactory ;
8989 private Key taskKey ;
9090 private Entity testEntity ;
91- private DateTime startDate ;
92- private DateTime endDate ;
93- private DateTime includedDate ;
91+ private Timestamp startDate ;
92+ private Timestamp endDate ;
93+ private Timestamp includedDate ;
9494
9595 @ Rule
9696 public ExpectedException thrown = ExpectedException .none ();
@@ -121,11 +121,11 @@ public void setUp() {
121121 testEntity = Entity .newBuilder (taskKey , TEST_FULL_ENTITY ).build ();
122122 Calendar calendar = Calendar .getInstance (TimeZone .getTimeZone ("UTC" ));
123123 calendar .set (1990 , JANUARY , 1 );
124- startDate = DateTime . copyFrom (calendar );
124+ startDate = Timestamp . of (calendar . getTime () );
125125 calendar .set (2000 , JANUARY , 1 );
126- endDate = DateTime . copyFrom (calendar );
126+ endDate = Timestamp . of (calendar . getTime () );
127127 calendar .set (1999 , DECEMBER , 31 );
128- includedDate = DateTime . copyFrom (calendar );
128+ includedDate = Timestamp . of (calendar . getTime () );
129129 }
130130
131131 /**
@@ -136,7 +136,7 @@ public void setUp() {
136136 */
137137 @ AfterClass
138138 public static void afterClass () throws IOException , InterruptedException , TimeoutException {
139- HELPER .stop (Duration .standardMinutes (1 ));
139+ HELPER .stop (Duration .ofMinutes (1 ));
140140 }
141141
142142 private void assertValidKey (Key taskKey ) {
@@ -209,7 +209,7 @@ public void testProperties() {
209209 // [START properties]
210210 Entity task = Entity .newBuilder (taskKey )
211211 .set ("category" , "Personal" )
212- .set ("created" , DateTime .now ())
212+ .set ("created" , Timestamp .now ())
213213 .set ("done" , false )
214214 .set ("priority" , 4 )
215215 .set ("percent_complete" , 10.0 )
@@ -752,7 +752,7 @@ public void testExplodingProperties() {
752752 Entity task = Entity .newBuilder (taskKey )
753753 .set ("tags" , "fun" , "programming" , "learn" )
754754 .set ("collaborators" , "alice" , "bob" , "charlie" )
755- .set ("created" , DateTime .now ())
755+ .set ("created" , Timestamp .now ())
756756 .build ();
757757 // [END exploding_properties]
758758 assertValidEntity (task );
0 commit comments