@Test
public void testInsertSmellCategory() {

    smell.id = createSmell(projectId, smell, queries);
    Commit commit = prepareCommit();
    // Insert will fail if commit does not exists
    executeFailure(
            queries.smellCategoryInsertionStatement(projectId, "any", smell, SmellCategory.INTRODUCTION)
    );
    // Insert will go to the right category
    executeSuccess(
            queries.smellCategoryInsertionStatement(projectId, commit.sha, smell, SmellCategory.INTRODUCTION)
    );
    assertEquals(1, getSmellCount(SmellCategory.INTRODUCTION));
    assertEquals(0, getSmellCount(SmellCategory.REFACTOR));
    assertEquals(0, getSmellCount(SmellCategory.PRESENCE));
    executeSuccess(
            queries.smellCategoryInsertionStatement(projectId, commit.sha, smell, SmellCategory.REFACTOR)
    );
    assertEquals(1, getSmellCount(SmellCategory.INTRODUCTION));
    assertEquals(1, getSmellCount(SmellCategory.REFACTOR));
    assertEquals(0, getSmellCount(SmellCategory.PRESENCE));
    executeSuccess(
            queries.smellCategoryInsertionStatement(projectId, commit.sha, smell, SmellCategory.PRESENCE)
    );
    assertEquals(1, getSmellCount(SmellCategory.INTRODUCTION));
    assertEquals(1, getSmellCount(SmellCategory.REFACTOR));
    assertEquals(1, getSmellCount(SmellCategory.PRESENCE));
    // Two inserts in same category won't update category count.
    executeFailure(
            queries.smellCategoryInsertionStatement(projectId, commit.sha, smell, SmellCategory.PRESENCE)
    );
    assertEquals(1, getSmellCount(SmellCategory.INTRODUCTION));
    assertEquals(1, getSmellCount(SmellCategory.REFACTOR));
    assertEquals(1, getSmellCount(SmellCategory.PRESENCE));
}