Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

69
Views
Why are RectF objects empty in UnitTests

Project:
I'm developing an Android application that matches MotionEvents to Rectangles which I defined using the RectF class.

Issue:
In my UnitTests these RectF objects are empty. The debugger describes them as "null" and left,top,right,bottom are 0.0

My guess:
I guess AndroidStudio replaces the RectF with some empty mock (as it apparently does with other code as well). I can't verify it in another IDE currently.

UnitTest code:

import android.graphics.RectF
import junit.framework.TestCase
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.core.Is.`is`
import org.junit.Test

class RectTest: TestCase() {
    @Test
    fun test() {
        val rectF = RectF( -10.0F, -30F, 10F, 50F )
        assertThat( rectF.width(), `is`( 20F ) )
    }
}

Note that the test class is in src/test not in src/androidTest.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!