Java Code Examples for com.helger.commons.mock.CommonsTestHelper#testDefaultImplementationWithEqualContentObject()
The following examples show how to use
com.helger.commons.mock.CommonsTestHelper#testDefaultImplementationWithEqualContentObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileSystemResourceTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testAccess () { FileSystemResource fr = new FileSystemResource ("pom.xml"); assertTrue (fr.exists ()); assertTrue (fr.getResourceID ().endsWith ("pom.xml")); assertTrue (fr.getPath ().endsWith ("pom.xml")); StreamHelper.close (fr.getReader (StandardCharsets.ISO_8859_1)); final byte [] aBytes = StreamHelper.getAllBytes (fr); assertTrue (aBytes.length > 0); assertNotNull (fr.getAsURL ()); assertNotNull (fr.getAsFile ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (fr, new FileSystemResource ("pom.xml")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (fr, fr.getReadableCloneForPath ("pom.xml")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (fr, fr.getWritableCloneForPath ("pom.xml")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (fr, new FileSystemResource ("pom.xml2")); fr = new FileSystemResource ("this file does not exist"); assertFalse (fr.exists ()); assertNull (fr.getInputStream ()); assertNull (fr.getReader (StandardCharsets.ISO_8859_1)); }
Example 2
Source File: HttpHeaderMapTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testEmpty () { final HttpHeaderMap h = new HttpHeaderMap (); assertTrue (h.isEmpty ()); assertFalse (h.isNotEmpty ()); assertEquals (0, h.size ()); assertNotNull (h.getAllHeaderLines (true)); assertTrue (h.getAllHeaderLines (true).isEmpty ()); assertNotNull (h.getAllHeaderLines (false)); assertTrue (h.getAllHeaderLines (false).isEmpty ()); assertNotNull (h.getAllHeaderNames ()); assertTrue (h.getAllHeaderNames ().isEmpty ()); assertNotNull (h.getAllHeaders ()); assertTrue (h.getAllHeaders ().isEmpty ()); assertNotNull (h.getAllHeaderValues ("key1")); assertTrue (h.getAllHeaderValues ("key1").isEmpty ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (h, new HttpHeaderMap ()); CommonsTestHelper.testGetClone (h); CommonsTestHelper.testDefaultSerialization (h); }
Example 3
Source File: FileSystemByteStreamProviderTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testAll () { final FileSystemByteStreamProvider aFSSR = new FileSystemByteStreamProvider (new File (".")); final InputStream aIS = aFSSR.getInputStream ("pom.xml"); assertNotNull (aIS); StreamHelper.close (aIS); final OutputStream aOS = aFSSR.getOutputStream ("$deleteme.txt", EAppend.DEFAULT); assertNotNull (aOS); StreamHelper.close (aOS); assertTrue (FileOperations.deleteFile (new File ("$deleteme.txt")).isSuccess ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FileSystemByteStreamProvider (new File (".")), new FileSystemByteStreamProvider (new File ("."))); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FileSystemByteStreamProvider (new File (".")), new FileSystemByteStreamProvider (".")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FileSystemByteStreamProvider (new File (".")), new FileSystemByteStreamProvider (new File (".."))); }
Example 4
Source File: GraphRelationTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testGet () { final GraphNode nf = new GraphNode (); final GraphNode nt = new GraphNode (); final GraphRelation gr = new GraphRelation (nf, nt); assertEquals (2, gr.getAllConnectedNodes ().size ()); assertTrue (gr.getAllConnectedNodes ().contains (nf)); assertTrue (gr.getAllConnectedNodes ().contains (nt)); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new GraphRelation ("id1", nf, nt), new GraphRelation ("id1", nf, nt)); // different IDs CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new GraphRelation (nf, nt), new GraphRelation (nf, nt)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new GraphRelation ("id1", nf, nt), new GraphRelation ("id1", nf, new GraphNode ())); }
Example 5
Source File: StringIDFromGlobalIntIDFactoryTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testAll () { final StringIDFromGlobalIntIDFactory x = new StringIDFromGlobalIntIDFactory ("idd"); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, new StringIDFromGlobalIntIDFactory ("idd")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, new StringIDFromGlobalIntIDFactory ("prefix")); assertTrue (x.getNewID ().startsWith ("idd")); try { new StringIDFromGlobalIntIDFactory (null); fail (); } catch (final NullPointerException ex) {} }
Example 6
Source File: DefaultTreeTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testEqualsHashCode () { final DefaultTree <String> t = new DefaultTree <> (); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (t, new DefaultTree <String> ()); t.getRootItem ().createChildItem ("data"); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (t, new DefaultTree <String> ()); }
Example 7
Source File: CSSHSLTest.java From ph-css with Apache License 2.0 | 5 votes |
@Test public void testBasic () { final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, false); final CSSHSL aColor = new CSSHSL (1, 2, 3); assertEquals ("hsl(1,2%,3%)", aColor.getAsCSSString (aSettings)); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSHSL (aColor)); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSHSL (1, 2, 3)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (0, 2, 3)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (1, 0, 3)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (1, 2, 0)); }
Example 8
Source File: ChangeWithValueTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testAll () { ChangeWithValue <String> x = new ChangeWithValue <> (EChange.CHANGED, "bla"); assertTrue (x.isChanged ()); assertFalse (x.isUnchanged ()); assertEquals ("bla", x.get ()); assertEquals ("bla", x.getIfChanged ("other")); assertEquals ("bla", x.getIfChangedOrNull ()); assertEquals ("other", x.getIfUnchanged ("other")); assertNull (x.getIfUnchangedOrNull ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, ChangeWithValue.createChanged ("bla")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, ChangeWithValue.createUnchanged ("bla")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, ChangeWithValue.createChanged ("Other")); x = new ChangeWithValue <> (EChange.CHANGED, null); assertNull (x.get ()); try { new ChangeWithValue <> (null, "bla"); fail (); } catch (final NullPointerException ex) {} }
Example 9
Source File: DefaultTreeItemWithIDTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testStdMethods () { final DefaultTreeWithID <String, String> t = new DefaultTreeWithID <> (); final DefaultTreeWithID <String, String> t2 = new DefaultTreeWithID <> (); t2.getRootItem ().createChildItem ("dataid", "Data"); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (t.getRootItem (), new DefaultTreeWithID <String, String> ().getRootItem ()); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (t.getRootItem (), t2.getRootItem ()); }
Example 10
Source File: VersionRangeTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testEquals () { final VersionRange vr1 = VersionRange.parse ("(1.2,2.0]"); assertEquals (vr1, vr1); assertNotEquals (vr1, null); assertNotEquals (vr1, "Not a VersionRange"); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (vr1, VersionRange.parse ("(1.2,2.0]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("[1.2,2.0]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("(1.2,2.0)")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("[1.2,2.0)")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("(1.2,]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("(,2.0]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("(1.3,2.0]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (vr1, VersionRange.parse ("(1.2,2.1]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (VersionRange.parse ("(,2.0]"), VersionRange.parse ("(,2.1]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (VersionRange.parse ("(1.2]"), VersionRange.parse ("(1.3]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (VersionRange.parse ("(1.2,]"), VersionRange.parse ("(,2.0]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (VersionRange.parse ("(,2.0]"), VersionRange.parse ("(1.2,]")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (VersionRange.parse ("(1.2]"), VersionRange.parse ("(1.2]")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (VersionRange.parse ("(1.2]"), VersionRange.parse ("(1.2)")); }
Example 11
Source File: LoggingLRUMapTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testAll () { final LoggingLRUMap <String, String> c = new LoggingLRUMap <> (5); assertNull (c.getMapName ()); c.setMapName ("name"); assertEquals ("name", c.getMapName ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (c, new LoggingLRUMap <String, String> (5).setMapName ("name")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (c, new LoggingLRUMap <String, String> (5).setMapName ("name2")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (c, new LoggingLRUMap <String, String> (6).setMapName ("name")); // Check overflow for (int i = 0; i < c.getMaxSize () + 1; ++i) c.put (Integer.toString (i), Integer.toString (i)); assertEquals (c.getMaxSize (), c.size ()); try { // Invalid name new LoggingLRUMap <String, String> (-1); fail (); } catch (final IllegalArgumentException ex) {} }
Example 12
Source File: MapEntryTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testCtor () { final MapEntry <String, Object> e = new MapEntry <> ("Key", "value"); assertEquals ("Key", e.getKey ()); assertEquals ("value", e.getValue ()); assertEquals ("value", e.setValue ("new")); assertEquals ("new", e.getValue ()); assertNotEquals (e, null); assertNotEquals (e, "bla"); assertEquals (e, e); assertEquals (e, new MapEntry <String, Object> ("Key", "new")); assertFalse (e.equals (new MapEntry <String, Object> ("Key", Integer.valueOf (17)))); assertEquals (e.hashCode (), new MapEntry <String, Object> ("Key", "new").hashCode ()); assertNotNull (e.toString ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new MapEntry <String, Object> ("Key", "value"), new MapEntry <String, Object> ("Key", "value")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new MapEntry <String, Object> ("Key", "value"), new MapEntry <String, Object> ("Key", "value2")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new MapEntry <String, Object> ("Key", "value"), new MapEntry <String, Object> ("Key2", "value")); }
Example 13
Source File: ClassPathResourceProviderTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testEqualsAndHashcode () { CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new ClassPathResourceProvider (), new ClassPathResourceProvider ()); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new ClassPathResourceProvider (), new ClassPathResourceProvider ("folder")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new ClassPathResourceProvider ("folder"), new ClassPathResourceProvider ("folder")); }
Example 14
Source File: SimpleLocationTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testBasic () { SimpleLocation re = new SimpleLocation ("xx"); assertEquals ("xx", re.getResourceID ()); assertEquals (ILocation.ILLEGAL_NUMBER, re.getLineNumber ()); assertEquals (ILocation.ILLEGAL_NUMBER, re.getColumnNumber ()); assertEquals ("xx", re.getAsString ()); re = new SimpleLocation ("xx", 5, ILocation.ILLEGAL_NUMBER); assertEquals ("xx", re.getResourceID ()); assertEquals (5, re.getLineNumber ()); assertEquals (ILocation.ILLEGAL_NUMBER, re.getColumnNumber ()); assertEquals ("xx(5:?)", re.getAsString ()); re = new SimpleLocation ("xx", 5, 7); assertEquals ("xx", re.getResourceID ()); assertEquals (5, re.getLineNumber ()); assertEquals (7, re.getColumnNumber ()); assertEquals ("xx(5:7)", re.getAsString ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new SimpleLocation ("xx"), new SimpleLocation ("xx")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new SimpleLocation ("xx"), new SimpleLocation ("xx2")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new SimpleLocation ("xx", 0, 1), new SimpleLocation ("xx", 1, 1)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new SimpleLocation ("xx", 0, 1), new SimpleLocation ("xx", 0, 0)); }
Example 15
Source File: DefaultTreeItemWithUniqueIDFactoryTest.java From ph-commons with Apache License 2.0 | 5 votes |
@Test public void testUniqueness () { final DefaultTreeItemWithUniqueIDFactory <String, String> x = new DefaultTreeItemWithUniqueIDFactory <> (); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, new DefaultTreeItemWithUniqueIDFactory <String, String> ()); x.create (x.createRoot (), "any"); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, new DefaultTreeItemWithUniqueIDFactory <String, String> ()); }
Example 16
Source File: ThirdPartyModuleTest.java From ph-commons with Apache License 2.0 | 4 votes |
@Test public void testStd () { CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1), new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1)); final ThirdPartyModule mod = new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1, Version.parse ("1.1"), "url", true); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (mod, new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1, Version.parse ("1.1"), "url", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname2", "owner", ELicense.APACHE1, Version.parse ("1.1"), "url", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname", "owner2", ELicense.APACHE1, Version.parse ("1.1"), "url", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname", "owner", ELicense.APACHE2, Version.parse ("1.1"), "url", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1, Version.parse ("1.1.2"), "url", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1, Version.parse ("1.1"), "url2", true)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (mod, new ThirdPartyModule ("displayname", "owner", ELicense.APACHE1, Version.parse ("1.1"), "url", false)); }
Example 17
Source File: FormatableObjectTest.java From ph-commons with Apache License 2.0 | 4 votes |
@Test public void testImpl () { CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FormatableObject <> ("Any", FormatterStringPrefixAndSuffix.createWithBrackets ()), new FormatableObject <> ("Any", FormatterStringPrefixAndSuffix.createWithBrackets ())); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatableObject <> ("Any", FormatterStringPrefixAndSuffix.createWithBrackets ()), new FormatableObject <> ("Any2", FormatterStringPrefixAndSuffix.createWithBrackets ())); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatableObject <> ("Any", FormatterStringPrefixAndSuffix.createWithBrackets ()), new FormatableObject <> ("Any", FormatterStringPrefixAndSuffix.createPrefixOnly ("oprefix"))); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (FormatterStringPrefixAndSuffix.createWithBrackets (), FormatterStringPrefixAndSuffix.createWithBrackets ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FormatterMinLengthAddLeading (10, ' '), new FormatterMinLengthAddLeading (10, ' ')); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterMinLengthAddLeading (10, ' '), new FormatterMinLengthAddLeading (10, 'x')); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterMinLengthAddLeading (10, ' '), new FormatterMinLengthAddLeading (5, ' ')); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FormatterMinLengthAddTrailing (10, ' '), new FormatterMinLengthAddTrailing (10, ' ')); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterMinLengthAddTrailing (10, ' '), new FormatterMinLengthAddTrailing (10, 'x')); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterMinLengthAddTrailing (10, ' '), new FormatterMinLengthAddTrailing (5, ' ')); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new FormatterStringPrefixAndSuffix ("p", "s"), new FormatterStringPrefixAndSuffix ("p", "s")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterStringPrefixAndSuffix ("p", "s"), new FormatterStringPrefixAndSuffix ("p", "ss")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new FormatterStringPrefixAndSuffix ("p", "s"), new FormatterStringPrefixAndSuffix ("pp", "s")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (FormatterStringPrefixAndSuffix.createPrefixOnly ("p"), FormatterStringPrefixAndSuffix.createPrefixOnly ("p")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (FormatterStringPrefixAndSuffix.createPrefixOnly ("p"), FormatterStringPrefixAndSuffix.createPrefixOnly ("pp")); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (FormatterStringPrefixAndSuffix.createSuffixOnly ("s"), FormatterStringPrefixAndSuffix.createSuffixOnly ("s")); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (FormatterStringPrefixAndSuffix.createSuffixOnly ("s"), FormatterStringPrefixAndSuffix.createSuffixOnly ("ss")); }
Example 18
Source File: URLResourceProviderTest.java From ph-commons with Apache License 2.0 | 4 votes |
@Test public void testEqualsAndHashcode () { CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new URLResourceProvider (), new URLResourceProvider ()); }
Example 19
Source File: MutableFloatTest.java From ph-commons with Apache License 2.0 | 4 votes |
@Test public void testMutableFloat () { final MutableFloat x = new MutableFloat (0f); assertEquals (0, x.floatValue (), DELTA); assertEquals (Float.valueOf (0), x.getAsFloat ()); assertFalse (x.isNot0 ()); assertTrue (x.is0 ()); x.inc (); assertEquals (1, x.floatValue (), DELTA); assertNotEquals (x.hashCode (), x.floatValue (), DELTA); x.inc (5); assertEquals (6, x.floatValue (), DELTA); assertNotEquals (x.hashCode (), x.floatValue (), DELTA); x.inc (-2); assertEquals (4, x.floatValue (), DELTA); assertNotEquals (x.hashCode (), x.floatValue (), DELTA); x.dec (); assertEquals (3, x.floatValue (), DELTA); assertNotEquals (x.hashCode (), x.floatValue (), DELTA); x.dec (5); assertEquals (-2, x.floatValue (), DELTA); assertTrue (x.isNot0 ()); assertFalse (x.is0 ()); assertNotEquals (x.hashCode (), x.floatValue (), DELTA); assertTrue (x.set (4711).isChanged ()); assertFalse (x.set (4711).isChanged ()); assertEquals (4711, x.floatValue (), DELTA); assertEquals (-1, new MutableFloat (4).compareTo (new MutableFloat (5))); assertEquals (0, new MutableFloat (5).compareTo (new MutableFloat (5))); assertEquals (+1, new MutableFloat (6).compareTo (new MutableFloat (5))); assertNotNull (x.toString ()); assertTrue (x.toString ().contains (Float.toString (x.floatValue ()))); x.set (-1); assertFalse (x.isGT0 ()); x.set (0); assertFalse (x.isGT0 ()); x.set (1); assertTrue (x.isGT0 ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new MutableFloat (3.1234f), new MutableFloat (3.1234f)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new MutableFloat (3.1234f), new MutableFloat (3.123f)); CommonsTestHelper.testGetClone (new MutableFloat (47.11f)); }
Example 20
Source File: MutableByteTest.java From ph-commons with Apache License 2.0 | 4 votes |
@Test public void testMutableByte () { final MutableByte x = new MutableByte (0); assertEquals (0, x.byteValue ()); assertEquals (Byte.valueOf ((byte) 0), x.getAsByte ()); assertFalse (x.isNot0 ()); assertTrue (x.is0 ()); x.inc (); assertEquals (1, x.byteValue ()); assertNotEquals (x.hashCode (), x.byteValue ()); x.inc (5); assertEquals (6, x.byteValue ()); assertNotEquals (x.hashCode (), x.byteValue ()); x.inc (-2); assertEquals (4, x.byteValue ()); assertNotEquals (x.hashCode (), x.byteValue ()); x.dec (); assertEquals (3, x.byteValue ()); assertFalse (x.isEven ()); assertNotEquals (x.hashCode (), x.byteValue ()); x.dec (5); assertEquals (-2, x.byteValue ()); assertTrue (x.isNot0 ()); assertFalse (x.is0 ()); assertTrue (x.isEven ()); assertNotEquals (x.hashCode (), x.byteValue ()); assertTrue (x.set (255).isChanged ()); assertFalse (x.set (255).isChanged ()); assertFalse (x.isEven ()); assertEquals (-1, x.byteValue ()); assertTrue (x.set (0).isChanged ()); assertEquals (0, x.byteValue ()); assertTrue (x.set (127).isChanged ()); assertEquals (127, x.byteValue ()); assertTrue (x.set (128).isChanged ()); assertEquals (-128, x.byteValue ()); assertTrue (x.set (255).isChanged ()); assertEquals (-1, x.byteValue ()); assertTrue (x.set (256).isChanged ()); assertEquals (0, x.byteValue ()); assertTrue (x.set (257).isChanged ()); assertEquals (1, x.byteValue ()); assertEquals (-1, new MutableByte (4).compareTo (new MutableByte (5))); assertEquals (0, new MutableByte (5).compareTo (new MutableByte (5))); assertEquals (+1, new MutableByte (6).compareTo (new MutableByte (5))); assertNotNull (x.toString ()); assertTrue (x.toString ().contains (Integer.toString (x.byteValue ()))); x.set (-1); assertFalse (x.isGT0 ()); x.set (0); assertFalse (x.isGT0 ()); x.set (1); assertTrue (x.isGT0 ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new MutableByte (-7), new MutableByte (-7)); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new MutableByte (6), new MutableByte (7)); CommonsTestHelper.testGetClone (new MutableByte (Integer.MAX_VALUE)); }