-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SonarCloud quality suggestions #159
- Loading branch information
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/test/java/de/gwdg/metadataqa/api/model/XmlFieldInstanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package de.gwdg.metadataqa.api.model; | ||
|
||
import junit.framework.TestCase; | ||
import org.junit.Test; | ||
|
||
public class XmlFieldInstanceTest extends TestCase { | ||
|
||
@Test | ||
public void testToString_noLang() { | ||
XmlFieldInstance x = new XmlFieldInstance("test"); | ||
assertEquals("XmlFieldInstance{value=test, language=null}", x.toString()); | ||
} | ||
|
||
@Test | ||
public void testToString_lang() { | ||
XmlFieldInstance x = new XmlFieldInstance("test", "en"); | ||
assertEquals("XmlFieldInstance{value=test, language=en}", x.toString()); | ||
} | ||
|
||
@Test | ||
public void testHashCode() { | ||
XmlFieldInstance x = new XmlFieldInstance("test"); | ||
assertEquals(67575267, x.hashCode()); | ||
} | ||
|
||
@Test | ||
public void testHashCode_lang() { | ||
XmlFieldInstance x = new XmlFieldInstance("test", "en"); | ||
assertEquals(67578508, x.hashCode()); | ||
} | ||
|
||
@Test | ||
public void testEquals_1() { | ||
XmlFieldInstance a = new XmlFieldInstance("test"); | ||
XmlFieldInstance b = new XmlFieldInstance("test"); | ||
assertTrue(a.equals(b)); | ||
assertTrue(b.equals(a)); | ||
} | ||
|
||
@Test | ||
public void testEquals_2() { | ||
XmlFieldInstance a = new XmlFieldInstance("test1"); | ||
XmlFieldInstance b = new XmlFieldInstance("test2"); | ||
assertFalse(a.equals(b)); | ||
assertFalse(b.equals(a)); | ||
} | ||
|
||
@Test | ||
public void testEquals_3() { | ||
XmlFieldInstance a = new XmlFieldInstance("test", "en"); | ||
XmlFieldInstance b = new XmlFieldInstance("test", "en"); | ||
assertTrue(a.equals(b)); | ||
assertTrue(b.equals(a)); | ||
} | ||
|
||
@Test | ||
public void testEquals_4() { | ||
XmlFieldInstance a = new XmlFieldInstance("test", "en"); | ||
XmlFieldInstance b = new XmlFieldInstance("test", "de"); | ||
assertFalse(a.equals(b)); | ||
assertFalse(b.equals(a)); | ||
} | ||
} |