1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-20 12:42:06 +02:00
2
Writing a unit test
cyian-1756 edited this page 2018-06-22 21:02:55 -04:00

Step 1: Create the unit test file

Create the unit test file in src/test/java/com/rarchives/ripme/tst/ripper/rippers

File should follow the naming scheme RipperTest.java

Step 2: Extend the RippersTest class

public class YoursiteRipper extends RippersTest {

Step 3: Write the main unit test

   public void test<Site>Rip() throws IOException {
        <Site>Ripper ripper = new DribbbleRipper(new URL(<URL the ripper supports>));
        testRipper(ripper);
    }

You should do this for every album type that the ripper supports

Step 4: Write tests for getGID and getAlbumTitle // Optional!

Althought not required you should write a unit test for getGID and getAlbumbTitle (If your ripper supports getAlbumbTitle)

An example of both of these can be found in the zizki ripper


    public void testGetGID() throws IOException {
        URL url = new URL("http://zizki.com/dee-chorde/we-got-spirit");
        ZizkiRipper ripper = new ZizkiRipper(url);
        assertEquals("dee-chorde", ripper.getGID(url));
    }

    public void testAlbumTitle() throws IOException {
        URL url = new URL("http://zizki.com/dee-chorde/we-got-spirit");
        ZizkiRipper ripper = new ZizkiRipper(url);
        assertEquals("zizki_Dee Chorde_We Got Spirit", ripper.getAlbumTitle(url));
    }