Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30f444bf authored by Shai Barack's avatar Shai Barack
Browse files

Fixed expected and actual order in tests.

In JUnit assertions the expected value should be the first and the actual
should be the second. Some of the tests had this order reversed which
makes test failures harder to understand.

Bug: 402537016
Flag: EXEMPT test-only
Change-Id: Ibfc68146c58078be696b07c8693046d30f80d2e6
parent 2c7d3369
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -59,12 +59,12 @@ public class RateLimitingCacheTest {
        TestRateLimitingCache<Integer> s = new TestRateLimitingCache<>(0);

        int first = s.get(mFetcher);
        assertEquals(first, 0);
        assertEquals(0, first);
        int second = s.get(mFetcher);
        assertEquals(second, 1);
        assertEquals(1, second);
        s.advanceTime(20);
        int third = s.get(mFetcher);
        assertEquals(third, 2);
        assertEquals(2, third);
    }

    /**
@@ -76,17 +76,17 @@ public class RateLimitingCacheTest {
        TestRateLimitingCache<Integer> s = new TestRateLimitingCache<>(100);

        int first = s.get(mFetcher);
        assertEquals(first, 0);
        assertEquals(0, first);
        int second = s.get(mFetcher);
        // Too early to change
        assertEquals(second, 0);
        assertEquals(0, second);
        s.advanceTime(150);
        int third = s.get(mFetcher);
        // Changed by now
        assertEquals(third, 1);
        assertEquals(1, third);
        int fourth = s.get(mFetcher);
        // Too early to change again
        assertEquals(fourth, 1);
        assertEquals(1, fourth);
    }

    /**
@@ -98,11 +98,11 @@ public class RateLimitingCacheTest {
        TestRateLimitingCache<Integer> s = new TestRateLimitingCache<>(-1);

        int first = s.get(mFetcher);
        assertEquals(first, 0);
        assertEquals(0, first);
        s.advanceTime(200);
        // Should return the original value every time
        int second = s.get(mFetcher);
        assertEquals(second, 0);
        assertEquals(0, second);
    }

    /**
@@ -157,7 +157,7 @@ public class RateLimitingCacheTest {

        final long periodsElapsed = 1 + ((endTimeMillis - startTimeMillis) / periodMillis);
        final long expected = Math.min(100 + 100, periodsElapsed * maxCountPerPeriod) - 1;
        assertEquals(mCounter, expected);
        assertEquals(expected, mCounter);
    }

    /**
@@ -209,7 +209,7 @@ public class RateLimitingCacheTest {
        t1.join();
        t2.join();

        assertEquals(counter.get(), 2);
        assertEquals(2, counter.get());
    }

    /**