Skip to content

Commit

Permalink
Merge branch 'test/gh-8-increase-unit-test-code-coverage' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
arcticicestudio committed Jul 17, 2017
2 parents 3ca3778 + 1f57815 commit 2ad1b47
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion icecore-hashids.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
40 changes: 40 additions & 0 deletions src/test/java/com/arcticicestudio/icecore/hashids/HashidTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
title Hashid Unit Tests +
project icecore-hashids +
repository https://github.com/arcticicestudio/icecore-hashids +
author Arctic Ice Studio +
email [email protected] +
copyright Copyright (C) 2017 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
package com.arcticicestudio.icecore.hashids;


import org.junit.Test;

import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertTrue;

/**
* Unit tests for {@link Hashid} implementation.
*
* @author Arctic Ice Studio &lt;[email protected]&gt;
* @since 0.3.0
*/
public class HashidTest {

@Test
public void testEqualsSymmetric() {
Hashid h1 = new Hashid(new long[] {2, 17, 92}, "MjhWikW");
Hashid h2 = new Hashid(new long[] {2, 17, 92}, "MjhWikW");

assertTrue(h1.equals(h2) && h2.equals(h1));
assertTrue(h1.hashCode() == h2.hashCode());
assertTrue(h1.equals(h1));
assertFalse(h1.equals(null));

Long unequalClassObject = 12L;
assertFalse(h1.equals(unequalClassObject));
}
}

0 comments on commit 2ad1b47

Please sign in to comment.