Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-5456

Introduce PowerMock into our unit tests to reduce unnecessary method exposure

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      We should introduce PowerMock into our unit tests so that we don't have to expose methods intended to be used by unit tests.

      Here was Benoit's reply to a user of asynchbase about testability:

      OpenTSDB has unit tests that are mocking out HBaseClient just fine
      [1]. You can mock out pretty much anything on the JVM: final,
      private, JDK stuff, etc. All you need is the right tools. I've been
      very happy with PowerMock. It supports Mockito and EasyMock.

      I've never been keen on mutilating public interfaces for the sake of
      testing. With tools like PowerMock, we can keep the public APIs tidy
      while mocking and overriding anything, even in the most private guts
      of the classes.

      [1] https://github.com/stumbleupon/opentsdb/blob/master/src/uid/TestUniqueId.java#L66

      Attachments

        1. hbase-5456-v0.patch
          3 kB
          Jesse Yates

        Activity

          People

            Unassigned Unassigned
            zhihyu@ebaysf.com Ted Yu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: