Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 package org.apache.spark.streaming;
0019 
0020 import org.junit.Assert;
0021 import org.junit.Test;
0022 
0023 public class JavaTimeSuite {
0024 
0025   // Just testing the methods that are specially exposed for Java.
0026   // This does not repeat all tests found in the Scala suite.
0027 
0028   @Test
0029   public void testLess() {
0030     Assert.assertTrue(new Time(999).less(new Time(1000)));
0031   }
0032 
0033   @Test
0034   public void testLessEq() {
0035     Assert.assertTrue(new Time(1000).lessEq(new Time(1000)));
0036   }
0037 
0038   @Test
0039   public void testGreater() {
0040     Assert.assertTrue(new Time(1000).greater(new Time(999)));
0041   }
0042 
0043   @Test
0044   public void testGreaterEq() {
0045     Assert.assertTrue(new Time(1000).greaterEq(new Time(1000)));
0046   }
0047 
0048   @Test
0049   public void testPlus() {
0050     Assert.assertEquals(new Time(1100), new Time(1000).plus(new Duration(100)));
0051   }
0052 
0053   @Test
0054   public void testMinusTime() {
0055     Assert.assertEquals(new Duration(900), new Time(1000).minus(new Time(100)));
0056   }
0057 
0058   @Test
0059   public void testMinusDuration() {
0060     Assert.assertEquals(new Time(900), new Time(1000).minus(new Duration(100)));
0061   }
0062 
0063 }