Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleSingleByteCount()
        public virtual void ShouldHandleSingleByteCount()
        {
            // given
            int        max   = 256;
            GroupCache cache = GroupCache.select(HEAP, 100, max);

            // when
            AssertSetAndGet(cache, 10, 45);
            AssertSetAndGet(cache, 100, 145);
            AssertSetAndGet(cache, 1000, 245);

            // then
            try
            {
                cache.Set(10000, 345);
                fail("Shouldn't handle that");
            }
            catch (ArithmeticException)
            {
                // OK
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSwitchToTwoByteVersionBeyondSingleByteGroupIds()
        public virtual void ShouldSwitchToTwoByteVersionBeyondSingleByteGroupIds()
        {
            // given
            int        max   = 257;
            GroupCache cache = GroupCache.select(HEAP, 100, max);

            // when
            AssertSetAndGet(cache, 10, 123);
            AssertSetAndGet(cache, 100, 1234);
            AssertSetAndGet(cache, 1000, 12345);
            AssertSetAndGet(cache, 10000, 0xFFFF);

            // then
            try
            {
                cache.Set(100000, 123456);
                fail("Shouldn't handle that");
            }
            catch (ArithmeticException)
            {
                // OK
            }
        }
Esempio n. 3
0
 private void AssertSetAndGet(GroupCache cache, long nodeId, int groupId)
 {
     cache.Set(nodeId, groupId);
 }