Release 0.4 – Final Update

In the last post, I mentioned I’ll be working again on Marquez project. After writing Unit tests, I was eager to write more test for Marquez. So, I wrote two tests for this release. It was pretty hard initially as the way Marquez handles each of its modules is quite challenging. So, writing tests for different modules was difficult. But, I figured out after looking into the code, digging deep into some tests.

Let’s talk more about the issues I worked on for release 0.4.

I like writing JUnit tests as it is quite interesting. And my job was to bring the coverage closer to 75% which was currently below 25%. Let’s check out the code I wrote for this fix.

  public void testMap() throws SQLException {
    final ResultSet results = mock(ResultSet.class);
    when(results.getObject(Columns.ROW_UUID, UUID.class)).thenReturn(ROW_UUID);
    when(results.getObject(Columns.DATASET_UUID, UUID.class)).thenReturn(DATASET_UUID);
    when(results.getObject(Columns.DB_TABLE_INFO_UUID, UUID.class)).thenReturn(DB_TABLE_INFO_UUID);

    final StatementContext context = mock(StatementContext.class);

    final DbTableVersionRowMapper dbTableVersionRowMapper = new DbTableVersionRowMapper();
    final DbTableVersionRow dbTableVersionRow =, context);
    assertEquals(ROW_UUID, dbTableVersionRow.getUuid());
    assertEquals(CREATED_AT, dbTableVersionRow.getCreatedAt());
    assertEquals(DATASET_UUID, dbTableVersionRow.getDatasetUuid());
    assertEquals(DB_TABLE_INFO_UUID, dbTableVersionRow.getDbTableInfoUuid());
    assertEquals(DB_TABLE_NAME, dbTableVersionRow.getDbTable());

So, I had to mock the ResultSet and StatementContext class as you can see it above. Basically, we had to check whether the DbTableVersionRowMapper works as expected. So, we just pass two mock objects and after that check, if the output is what was expected by using assertEquals.


This is the second issue I’m currently fixing. As this test is to be written in a different package, it is quite difficult because all these modules work differently and their JUnits also needs to be implemented in a different way.

final DbTableVersion dbTableVersion =

    final DbTableVersionRow dbTableVersionRow =, dbTableInfoRow, dbTableVersion);
    assertEquals(G_UUID, dbTableVersionRow.getDatasetUuid());
    assertEquals(G_UUID, dbTableVersionRow.getDbTableInfoUuid());
    assertEquals(DB_TABLE_NAME.getValue(), dbTableVersionRow.getDbTable());

So, for this JUnit, you need to mock some objects, also build some mock objects. You can see above how I mocked DbTableVersion object. It actually passed all the checks but my forked repository wasn’t updated so I didn’t pull the latest changes. Unfortunately, some of the classes got changed which I was using for this test. So, I had to update my repository and had to make changes again. I’ll be working on this PR until it gets merged.

This release helped me to understand some core functionalities of Marquez and I gained invaluable experience. I’m happy to work on these fixes and hopefully will continue contributing to Marquez project.

Issue 1 Link

Issue 2 Link

Pull Request 1

Pull Request 2

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s