/// <summary>
        /// Trivial test case that verifies basic functionality of
        /// <see cref="JobIdHistoryFileInfoMap"/>
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestWithSingleElement()
        {
            HistoryFileManager.JobIdHistoryFileInfoMap mapWithSize = new HistoryFileManager.JobIdHistoryFileInfoMap
                                                                         ();
            JobId jobId = MRBuilderUtils.NewJobId(1, 1, 1);

            HistoryFileManager.HistoryFileInfo fileInfo1 = Org.Mockito.Mockito.Mock <HistoryFileManager.HistoryFileInfo
                                                                                     >();
            Org.Mockito.Mockito.When(fileInfo1.GetJobId()).ThenReturn(jobId);
            // add it twice
            NUnit.Framework.Assert.AreEqual("Incorrect return on putIfAbsent()", null, mapWithSize
                                            .PutIfAbsent(jobId, fileInfo1));
            NUnit.Framework.Assert.AreEqual("Incorrect return on putIfAbsent()", fileInfo1, mapWithSize
                                            .PutIfAbsent(jobId, fileInfo1));
            // check get()
            NUnit.Framework.Assert.AreEqual("Incorrect get()", fileInfo1, mapWithSize.Get(jobId
                                                                                          ));
            NUnit.Framework.Assert.IsTrue("Incorrect size()", CheckSize(mapWithSize, 1));
            // check navigableKeySet()
            NavigableSet <JobId> set = mapWithSize.NavigableKeySet();

            NUnit.Framework.Assert.AreEqual("Incorrect navigableKeySet()", 1, set.Count);
            NUnit.Framework.Assert.IsTrue("Incorrect navigableKeySet()", set.Contains(jobId));
            // check values()
            ICollection <HistoryFileManager.HistoryFileInfo> values = mapWithSize.Values();

            NUnit.Framework.Assert.AreEqual("Incorrect values()", 1, values.Count);
            NUnit.Framework.Assert.IsTrue("Incorrect values()", values.Contains(fileInfo1));
        }
示例#2
0
 /*
  * {@inheritDoc}
  *
  * @see java.util.NavigableSet#descendingSet()
  * @since 1.6
  */
 public NavigableSet <E> descendingSet()
 {
     return((null != descendingSetJ) ? descendingSetJ
             : (descendingSetJ = new TreeSet <E>(backingMap.descendingMap())));
 }