Dataset Viewer
	| repo
				 stringclasses 1
				value | licence_name
				 stringclasses 1
				value | sha
				 stringclasses 1
				value | language
				 stringclasses 1
				value | context
				 stringlengths 1.31k 10.9k | CLASS_NAME
				 stringlengths 3 21 | METHOD_NAME
				 stringlengths 3 33 | TEST_FILE
				 stringlengths 12 30 | LIBRARIES
				 stringclasses 1
				value | SUGGESTED_FRAMEWORK
				 stringclasses 1
				value | SOURCES
				 stringlengths 727 10.3k | CREATE_NEW_FILE
				 stringclasses 1
				value | CUSTOM_INSTRUCTIONS
				 stringclasses 1
				value | testCode
				 stringlengths 110 1.92k | testOffset
				 int64 129 6.72k | testPath
				 stringlengths 50 68 | codeUnderTest
				 stringlengths 50 2.04k | codeUnderTestOffset
				 int64 285 9.81k | codeUnderTestPath
				 stringlengths 46 64 | codeUnderTestType
				 stringclasses 1
				value | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `equals` method in the `ByteString` class. Put new test methods inside the file `ByteStringTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	ByteString | 
	equals | 
	ByteStringTest.java | 
	JUnit4 | 
	File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	false | 
	@Test
    public void shouldNotEquals() {
        byte[] bytes = "string".getBytes();
        ByteString byteString = new ByteString(bytes);
        assertFalse(byteString.equals(new Object()));
    } | 837 | 
	src/test/java/co/nstant/in/cbor/model/ByteStringTest.java | 
	@Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    } | 497 | 
	src/main/java/co/nstant/in/cbor/model/ByteString.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `hashCode` method in the `ByteString` class. Put new test methods inside the file `ByteStringTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	ByteString | 
	hashCode | 
	ByteStringTest.java | 
	JUnit4 | 
	File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	false | 
	@Test
    public void shouldHashcode() {
        ChunkableDataItem superClass = new ChunkableDataItem(MajorType.BYTE_STRING);
        byte[] bytes = "string".getBytes();
        ByteString byteString = new ByteString(bytes);
        assertEquals(byteString.hashCode(), superClass.hashCode() ^ Arrays.hashCode(bytes));
    } | 1,043 | 
	src/test/java/co/nstant/in/cbor/model/ByteStringTest.java | 
	@Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    } | 767 | 
	src/main/java/co/nstant/in/cbor/model/ByteString.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `getBytes` method in the `ByteString` class. Put new test methods inside the file `ByteStringTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	ByteString | 
	getBytes | 
	ByteStringTest.java | 
	JUnit4 | 
	File: ByteString.java
```
package co.nstant.in.cbor.model;
import java.util.Arrays;
public class ByteString extends ChunkableDataItem {
    private final byte[] bytes;
    public ByteString(byte[] bytes) {
        super(MajorType.BYTE_STRING);
        if (bytes == null) {
            this.bytes = null;
        } else {
            this.bytes = bytes;
        }
    }
    public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof ByteString) {
            ByteString other = (ByteString) object;
            return super.equals(object) && Arrays.equals(bytes, other.bytes);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Arrays.hashCode(bytes);
    }
}
``` | 
	false | 
	@Test
    public void shouldNotClone() {
        byte[] bytes = "see issue #18".getBytes();
        ByteString byteString = new ByteString(bytes);
        assertEquals(byteString.getBytes(), bytes);
    } | 1,372 | 
	src/test/java/co/nstant/in/cbor/model/ByteStringTest.java | 
	public byte[] getBytes() {
        if (bytes == null) {
            return null;
        } else {
            return bytes;
        }
    } | 352 | 
	src/main/java/co/nstant/in/cbor/model/ByteString.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `setTag` method in the `DataItem` class. Put new test methods inside the file `DataItemTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	DataItem | 
	setTag | 
	DataItemTest.java | 
	JUnit4 | 
	File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test(expected = NullPointerException.class)
    public void testSetTag_Tag_null() {
        DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
        di.setTag(null);
    } | 1,141 | 
	src/test/java/co/nstant/in/cbor/model/DataItemTest.java | 
	public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    } | 567 | 
	src/main/java/co/nstant/in/cbor/model/DataItem.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `setTag` method in the `DataItem` class. Put new test methods inside the file `DataItemTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	DataItem | 
	setTag | 
	DataItemTest.java | 
	JUnit4 | 
	File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test
    public void testGetTag() {
        DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
        di.setTag(new Tag(1));
        Tag t = di.getTag();
        assertEquals(1L, t.getValue());
    } | 1,326 | 
	src/test/java/co/nstant/in/cbor/model/DataItemTest.java | 
	public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    } | 567 | 
	src/main/java/co/nstant/in/cbor/model/DataItem.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `setTag` method in the `DataItem` class. Put new test methods inside the file `DataItemTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	DataItem | 
	setTag | 
	DataItemTest.java | 
	JUnit4 | 
	File: DataItem.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DataItem {
    private final MajorType majorType;
    private Tag tag;
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType() {
        return majorType;
    }
    public void setTag(long tag) {
        if (tag < 0) {
            throw new IllegalArgumentException("tag number must be 0 or greater");
        }
        this.tag = new Tag(tag);
    }
    public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    }
    public void removeTag() {
        tag = null;
    }
    public Tag getTag() {
        return tag;
    }
    public boolean hasTag() {
        return tag != null;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DataItem) {
            DataItem other = (DataItem) object;
            if (tag != null) {
                return tag.equals(other.tag) && majorType == other.majorType;
            } else {
                return other.tag == null && majorType == other.majorType;
            }
        }
        return false;
    }
    @Override
    public int hashCode() {
        return Objects.hash(majorType, tag);
    }
    protected void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
    public DataItem getOuterTaggable() {
        DataItem item = this;
        while (item.getTag() != null) {
            item = item.getTag();
        }
        return item;
    }
}
```
File: Tag.java
Package: co.nstant.in.cbor.model
```
public class Tag extends DataItem {
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test
    public void testRemoveTag() {
        DataItem di = new DataItem(MajorType.UNSIGNED_INTEGER);
        di.setTag(new Tag(1));
        assertNotNull(di.getTag());
        di.removeTag();
        assertNull(di.getTag());
    } | 1,750 | 
	src/test/java/co/nstant/in/cbor/model/DataItemTest.java | 
	public void setTag(Tag tag) {
        Objects.requireNonNull(tag, "tag is null");
        this.tag = tag;
    } | 567 | 
	src/main/java/co/nstant/in/cbor/model/DataItem.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `getLanguage` method in the `LanguageTaggedString` class. Put new test methods inside the file `LanguageTaggedStringTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: LanguageTaggedString.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class LanguageTaggedString extends Array {
    public LanguageTaggedString(String language, String string) {
        this(new UnicodeString(language), new UnicodeString(string));
    }
    public LanguageTaggedString(UnicodeString language, UnicodeString string) {
        setTag(38);
        add(Objects.requireNonNull(language));
        add(Objects.requireNonNull(string));
    }
    public UnicodeString getLanguage() {
        return (UnicodeString) getDataItems().get(0);
    }
    public UnicodeString getString() {
        return (UnicodeString) getDataItems().get(1);
    }
}
```
File: UnicodeString.java
Package: co.nstant.in.cbor.model
```
public class UnicodeString extends ChunkableDataItem {
    public UnicodeString(String string) {
        super(MajorType.UNICODE_STRING);
        this.string = string;
    }
    @Override
    public String toString();
    public String getString();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	LanguageTaggedString | 
	getLanguage | 
	LanguageTaggedStringTest.java | 
	JUnit4 | 
	File: LanguageTaggedString.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class LanguageTaggedString extends Array {
    public LanguageTaggedString(String language, String string) {
        this(new UnicodeString(language), new UnicodeString(string));
    }
    public LanguageTaggedString(UnicodeString language, UnicodeString string) {
        setTag(38);
        add(Objects.requireNonNull(language));
        add(Objects.requireNonNull(string));
    }
    public UnicodeString getLanguage() {
        return (UnicodeString) getDataItems().get(0);
    }
    public UnicodeString getString() {
        return (UnicodeString) getDataItems().get(1);
    }
}
```
File: UnicodeString.java
Package: co.nstant.in.cbor.model
```
public class UnicodeString extends ChunkableDataItem {
    public UnicodeString(String string) {
        super(MajorType.UNICODE_STRING);
        this.string = string;
    }
    @Override
    public String toString();
    public String getString();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test
    public void shouldInitializeWithStrings() {
        LanguageTaggedString lts = new LanguageTaggedString("en", "Hello");
        assertEquals(38, lts.getTag().getValue());
        assertEquals("en", lts.getLanguage().getString());
        assertEquals("Hello", lts.getString().getString());
    } | 149 | 
	src/test/java/co/nstant/in/cbor/model/LanguageTaggedStringTest.java | 
	public UnicodeString getLanguage() {
        return (UnicodeString) getDataItems().get(0);
    } | 520 | 
	src/main/java/co/nstant/in/cbor/model/LanguageTaggedString.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `encode` method in the `CborEncoder` class. Put new test methods inside the file `CborEncoderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborEncoder.java
```
package co.nstant.in.cbor;
import java.io.OutputStream;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.encoder.ArrayEncoder;
import co.nstant.in.cbor.encoder.ByteStringEncoder;
import co.nstant.in.cbor.encoder.MapEncoder;
import co.nstant.in.cbor.encoder.NegativeIntegerEncoder;
import co.nstant.in.cbor.encoder.SpecialEncoder;
import co.nstant.in.cbor.encoder.TagEncoder;
import co.nstant.in.cbor.encoder.UnicodeStringEncoder;
import co.nstant.in.cbor.encoder.UnsignedIntegerEncoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.NegativeInteger;
import co.nstant.in.cbor.model.SimpleValue;
import co.nstant.in.cbor.model.Special;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
import co.nstant.in.cbor.model.UnsignedInteger;
public class CborEncoder {
    private final UnsignedIntegerEncoder unsignedIntegerEncoder;
    private final NegativeIntegerEncoder negativeIntegerEncoder;
    private final ByteStringEncoder byteStringEncoder;
    private final UnicodeStringEncoder unicodeStringEncoder;
    private final ArrayEncoder arrayEncoder;
    private final MapEncoder mapEncoder;
    private final TagEncoder tagEncoder;
    private final SpecialEncoder specialEncoder;
    private boolean canonical = true;
    public CborEncoder(OutputStream outputStream) {
        Objects.requireNonNull(outputStream);
        unsignedIntegerEncoder = new UnsignedIntegerEncoder(this, outputStream);
        negativeIntegerEncoder = new NegativeIntegerEncoder(this, outputStream);
        byteStringEncoder = new ByteStringEncoder(this, outputStream);
        unicodeStringEncoder = new UnicodeStringEncoder(this, outputStream);
        arrayEncoder = new ArrayEncoder(this, outputStream);
        mapEncoder = new MapEncoder(this, outputStream);
        tagEncoder = new TagEncoder(this, outputStream);
        specialEncoder = new SpecialEncoder(this, outputStream);
    }
    public void encode(List<DataItem> dataItems) throws CborException {
        for (DataItem dataItem : dataItems) {
            encode(dataItem);
        }
    }
    public void encode(DataItem dataItem) throws CborException {
        if (dataItem == null) {
            dataItem = SimpleValue.NULL;
        }
        if (dataItem.hasTag()) {
            Tag tagDi = dataItem.getTag();
            encode(tagDi);
        }
        switch (dataItem.getMajorType()) {
        case UNSIGNED_INTEGER:
            unsignedIntegerEncoder.encode((UnsignedInteger) dataItem);
            break;
        case NEGATIVE_INTEGER:
            negativeIntegerEncoder.encode((NegativeInteger) dataItem);
            break;
        case BYTE_STRING:
            byteStringEncoder.encode((ByteString) dataItem);
            break;
        case UNICODE_STRING:
            unicodeStringEncoder.encode((UnicodeString) dataItem);
            break;
        case ARRAY:
            arrayEncoder.encode((Array) dataItem);
            break;
        case MAP:
            mapEncoder.encode((Map) dataItem);
            break;
        case SPECIAL:
            specialEncoder.encode((Special) dataItem);
            break;
        case TAG:
            tagEncoder.encode((Tag) dataItem);
            break;
        default:
            throw new CborException("Unknown major type");
        }
    }
    public boolean isCanonical() {
        return canonical;
    }
    public CborEncoder nonCanonical() {
        canonical = false;
        return this;
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	CborEncoder | 
	encode | 
	CborEncoderTest.java | 
	JUnit4 | 
	File: CborEncoder.java
```
package co.nstant.in.cbor;
import java.io.OutputStream;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.encoder.ArrayEncoder;
import co.nstant.in.cbor.encoder.ByteStringEncoder;
import co.nstant.in.cbor.encoder.MapEncoder;
import co.nstant.in.cbor.encoder.NegativeIntegerEncoder;
import co.nstant.in.cbor.encoder.SpecialEncoder;
import co.nstant.in.cbor.encoder.TagEncoder;
import co.nstant.in.cbor.encoder.UnicodeStringEncoder;
import co.nstant.in.cbor.encoder.UnsignedIntegerEncoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.NegativeInteger;
import co.nstant.in.cbor.model.SimpleValue;
import co.nstant.in.cbor.model.Special;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
import co.nstant.in.cbor.model.UnsignedInteger;
public class CborEncoder {
    private final UnsignedIntegerEncoder unsignedIntegerEncoder;
    private final NegativeIntegerEncoder negativeIntegerEncoder;
    private final ByteStringEncoder byteStringEncoder;
    private final UnicodeStringEncoder unicodeStringEncoder;
    private final ArrayEncoder arrayEncoder;
    private final MapEncoder mapEncoder;
    private final TagEncoder tagEncoder;
    private final SpecialEncoder specialEncoder;
    private boolean canonical = true;
    public CborEncoder(OutputStream outputStream) {
        Objects.requireNonNull(outputStream);
        unsignedIntegerEncoder = new UnsignedIntegerEncoder(this, outputStream);
        negativeIntegerEncoder = new NegativeIntegerEncoder(this, outputStream);
        byteStringEncoder = new ByteStringEncoder(this, outputStream);
        unicodeStringEncoder = new UnicodeStringEncoder(this, outputStream);
        arrayEncoder = new ArrayEncoder(this, outputStream);
        mapEncoder = new MapEncoder(this, outputStream);
        tagEncoder = new TagEncoder(this, outputStream);
        specialEncoder = new SpecialEncoder(this, outputStream);
    }
    public void encode(List<DataItem> dataItems) throws CborException {
        for (DataItem dataItem : dataItems) {
            encode(dataItem);
        }
    }
    public void encode(DataItem dataItem) throws CborException {
        if (dataItem == null) {
            dataItem = SimpleValue.NULL;
        }
        if (dataItem.hasTag()) {
            Tag tagDi = dataItem.getTag();
            encode(tagDi);
        }
        switch (dataItem.getMajorType()) {
        case UNSIGNED_INTEGER:
            unsignedIntegerEncoder.encode((UnsignedInteger) dataItem);
            break;
        case NEGATIVE_INTEGER:
            negativeIntegerEncoder.encode((NegativeInteger) dataItem);
            break;
        case BYTE_STRING:
            byteStringEncoder.encode((ByteString) dataItem);
            break;
        case UNICODE_STRING:
            unicodeStringEncoder.encode((UnicodeString) dataItem);
            break;
        case ARRAY:
            arrayEncoder.encode((Array) dataItem);
            break;
        case MAP:
            mapEncoder.encode((Map) dataItem);
            break;
        case SPECIAL:
            specialEncoder.encode((Special) dataItem);
            break;
        case TAG:
            tagEncoder.encode((Tag) dataItem);
            break;
        default:
            throw new CborException("Unknown major type");
        }
    }
    public boolean isCanonical() {
        return canonical;
    }
    public CborEncoder nonCanonical() {
        canonical = false;
        return this;
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test(expected = ClassCastException.class)
    public void shouldExpectSpecialImplementation() throws CborException {
        encoder.encode(new Mock(MajorType.SPECIAL));
    } | 1,996 | 
	src/test/java/co/nstant/in/cbor/CborEncoderTest.java | 
	/**
     * Encode a single {@link DataItem}.
     *
     * @param dataItem the {@link DataItem} to encode. If null, encoder encodes a
     *                 {@link SimpleValue} NULL value.
     * @throws CborException if {@link DataItem} could not be encoded or there was
     *                       an problem with the {@link OutputStream}.
     */
    public void encode(DataItem dataItem) throws CborException {
        if (dataItem == null) {
            dataItem = SimpleValue.NULL;
        }
        if (dataItem.hasTag()) {
            Tag tagDi = dataItem.getTag();
            encode(tagDi);
        }
        switch (dataItem.getMajorType()) {
        case UNSIGNED_INTEGER:
            unsignedIntegerEncoder.encode((UnsignedInteger) dataItem);
            break;
        case NEGATIVE_INTEGER:
            negativeIntegerEncoder.encode((NegativeInteger) dataItem);
            break;
        case BYTE_STRING:
            byteStringEncoder.encode((ByteString) dataItem);
            break;
        case UNICODE_STRING:
            unicodeStringEncoder.encode((UnicodeString) dataItem);
            break;
        case ARRAY:
            arrayEncoder.encode((Array) dataItem);
            break;
        case MAP:
            mapEncoder.encode((Map) dataItem);
            break;
        case SPECIAL:
            specialEncoder.encode((Special) dataItem);
            break;
        case TAG:
            tagEncoder.encode((Tag) dataItem);
            break;
        default:
            throw new CborException("Unknown major type");
        }
    } | 2,804 | 
	src/main/java/co/nstant/in/cbor/CborEncoder.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `hashCode` method in the `DoublePrecisionFloat` class. Put new test methods inside the file `DoublePrecisionFloatTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: DoublePrecisionFloat.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DoublePrecisionFloat extends Special {
    private final double value;
    public DoublePrecisionFloat(double value) {
        super(SpecialType.IEEE_754_DOUBLE_PRECISION_FLOAT);
        this.value = value;
    }
    public double getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DoublePrecisionFloat) {
            DoublePrecisionFloat other = (DoublePrecisionFloat) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
``` | 
	DoublePrecisionFloat | 
	hashCode | 
	DoublePrecisionFloatTest.java | 
	JUnit4 | 
	File: DoublePrecisionFloat.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DoublePrecisionFloat extends Special {
    private final double value;
    public DoublePrecisionFloat(double value) {
        super(SpecialType.IEEE_754_DOUBLE_PRECISION_FLOAT);
        this.value = value;
    }
    public double getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DoublePrecisionFloat) {
            DoublePrecisionFloat other = (DoublePrecisionFloat) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
``` | 
	false | 
	@Test
    public void testHashcode() {
        Special superClass = new Special(SpecialType.IEEE_754_DOUBLE_PRECISION_FLOAT);
        double value = 1.234;
        DoublePrecisionFloat doublePrecisionFloat = new DoublePrecisionFloat(value);
        assertEquals(superClass.hashCode() ^ Objects.hashCode(value), doublePrecisionFloat.hashCode());
    } | 732 | 
	src/test/java/co/nstant/in/cbor/model/DoublePrecisionFloatTest.java | 
	@Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    } | 641 | 
	src/main/java/co/nstant/in/cbor/model/DoublePrecisionFloat.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `toString` method in the `DoublePrecisionFloat` class. Put new test methods inside the file `DoublePrecisionFloatTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: DoublePrecisionFloat.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DoublePrecisionFloat extends Special {
    private final double value;
    public DoublePrecisionFloat(double value) {
        super(SpecialType.IEEE_754_DOUBLE_PRECISION_FLOAT);
        this.value = value;
    }
    public double getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DoublePrecisionFloat) {
            DoublePrecisionFloat other = (DoublePrecisionFloat) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
``` | 
	DoublePrecisionFloat | 
	toString | 
	DoublePrecisionFloatTest.java | 
	JUnit4 | 
	File: DoublePrecisionFloat.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class DoublePrecisionFloat extends Special {
    private final double value;
    public DoublePrecisionFloat(double value) {
        super(SpecialType.IEEE_754_DOUBLE_PRECISION_FLOAT);
        this.value = value;
    }
    public double getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof DoublePrecisionFloat) {
            DoublePrecisionFloat other = (DoublePrecisionFloat) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
``` | 
	false | 
	@Test
    public void testToString() {
        DoublePrecisionFloat doublePrecisionFloat = new DoublePrecisionFloat(1.234);
        assertEquals("1.234", doublePrecisionFloat.toString());
    } | 1,088 | 
	src/test/java/co/nstant/in/cbor/model/DoublePrecisionFloatTest.java | 
	@Override
    public String toString() {
        return String.valueOf(value);
    } | 749 | 
	src/main/java/co/nstant/in/cbor/model/DoublePrecisionFloat.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `getSimpleValueType` method in the `SimpleValue` class. Put new test methods inside the file `SimpleValueTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: SimpleValue.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class SimpleValue extends Special {
    private final SimpleValueType simpleValueType;
    public static final SimpleValue FALSE = new SimpleValue(SimpleValueType.FALSE);
    public static final SimpleValue TRUE = new SimpleValue(SimpleValueType.TRUE);
    public static final SimpleValue NULL = new SimpleValue(SimpleValueType.NULL);
    public static final SimpleValue UNDEFINED = new SimpleValue(SimpleValueType.UNDEFINED);
    private final int value;
    public SimpleValue(SimpleValueType simpleValueType) {
        super(SpecialType.SIMPLE_VALUE);
        this.value = simpleValueType.getValue();
        this.simpleValueType = simpleValueType;
    }
    public SimpleValue(int value) {
        super(value <= 23 ? SpecialType.SIMPLE_VALUE : SpecialType.SIMPLE_VALUE_NEXT_BYTE);
        this.value = value;
        this.simpleValueType = SimpleValueType.ofByte(value);
    }
    public SimpleValueType getSimpleValueType() {
        return simpleValueType;
    }
    public int getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof SimpleValue) {
            SimpleValue other = (SimpleValue) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return simpleValueType.toString();
    }
}
```
File: SimpleValueType.java
Package: co.nstant.in.cbor.model
```
public enum SimpleValueType {
    FALSE(20), TRUE(21), NULL(22), UNDEFINED(23), RESERVED(0), UNALLOCATED(0);
    private SimpleValueType(int value) {
        this.value = value;
    }
    public int getValue();
    public static SimpleValueType ofByte(int b);
}
``` | 
	SimpleValue | 
	getSimpleValueType | 
	SimpleValueTest.java | 
	JUnit4 | 
	File: SimpleValue.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class SimpleValue extends Special {
    private final SimpleValueType simpleValueType;
    public static final SimpleValue FALSE = new SimpleValue(SimpleValueType.FALSE);
    public static final SimpleValue TRUE = new SimpleValue(SimpleValueType.TRUE);
    public static final SimpleValue NULL = new SimpleValue(SimpleValueType.NULL);
    public static final SimpleValue UNDEFINED = new SimpleValue(SimpleValueType.UNDEFINED);
    private final int value;
    public SimpleValue(SimpleValueType simpleValueType) {
        super(SpecialType.SIMPLE_VALUE);
        this.value = simpleValueType.getValue();
        this.simpleValueType = simpleValueType;
    }
    public SimpleValue(int value) {
        super(value <= 23 ? SpecialType.SIMPLE_VALUE : SpecialType.SIMPLE_VALUE_NEXT_BYTE);
        this.value = value;
        this.simpleValueType = SimpleValueType.ofByte(value);
    }
    public SimpleValueType getSimpleValueType() {
        return simpleValueType;
    }
    public int getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof SimpleValue) {
            SimpleValue other = (SimpleValue) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return simpleValueType.toString();
    }
}
```
File: SimpleValueType.java
Package: co.nstant.in.cbor.model
```
public enum SimpleValueType {
    FALSE(20), TRUE(21), NULL(22), UNDEFINED(23), RESERVED(0), UNALLOCATED(0);
    private SimpleValueType(int value) {
        this.value = value;
    }
    public int getValue();
    public static SimpleValueType ofByte(int b);
}
``` | 
	false | 
	@Test
    public void shouldDecodeBoolean() throws CborException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        CborEncoder encoder = new CborEncoder(byteArrayOutputStream);
        encoder.encode(SimpleValue.TRUE);
        encoder.encode(SimpleValue.FALSE);
        byte[] encodedBytes = byteArrayOutputStream.toByteArray();
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(encodedBytes);
        List<DataItem> dataItems = new CborDecoder(byteArrayInputStream).decode();
        int result = 0;
        int position = 1;
        for (DataItem dataItem : dataItems) {
            position++;
            switch (dataItem.getMajorType()) {
            case SPECIAL:
                Special special = (Special) dataItem;
                switch (special.getSpecialType()) {
                case SIMPLE_VALUE:
                    SimpleValue simpleValue = (SimpleValue) special;
                    switch (simpleValue.getSimpleValueType()) {
                    case FALSE:
                        result += position * 2;
                        break;
                    case TRUE:
                        result += position * 3;
                        break;
                    default:
                        break;
                    }
                    break;
                default:
                    break;
                }
                break;
            default:
                break;
            }
        }
        assertEquals(12, result);
    } | 490 | 
	src/test/java/co/nstant/in/cbor/decoder/SimpleValueDecoderTest.java | 
	public SimpleValueType getSimpleValueType() {
        return simpleValueType;
    } | 960 | 
	src/main/java/co/nstant/in/cbor/model/SimpleValue.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `hashCode` method in the `Tag` class. Put new test methods inside the file `TagTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	Tag | 
	hashCode | 
	TagTest.java | 
	JUnit4 | 
	File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	false | 
	@Test
    public void testHashcode() {
        DataItem superClass = new DataItem(MajorType.TAG);
        for (long i = 0; i < 256; i++) {
            Tag tag = new Tag(i);
            assertEquals(tag.hashCode(), superClass.hashCode() ^ Objects.hashCode(i));
        }
    } | 246 | 
	src/test/java/co/nstant/in/cbor/model/TagTest.java | 
	@Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    } | 521 | 
	src/main/java/co/nstant/in/cbor/model/Tag.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `equals` method in the `Tag` class. Put new test methods inside the file `TagTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	Tag | 
	equals | 
	TagTest.java | 
	JUnit4 | 
	File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	false | 
	@Test
    public void testEquals1() {
        for (int i = 0; i < 256; i++) {
            Tag tag1 = new Tag(i);
            Tag tag2 = new Tag(i);
            assertTrue(tag1.equals(tag2));
        }
    } | 527 | 
	src/test/java/co/nstant/in/cbor/model/TagTest.java | 
	@Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    } | 285 | 
	src/main/java/co/nstant/in/cbor/model/Tag.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `equals` method in the `Tag` class. Put new test methods inside the file `TagTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	Tag | 
	equals | 
	TagTest.java | 
	JUnit4 | 
	File: Tag.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Tag extends DataItem {
    private final long value;
    public Tag(long value) {
        super(MajorType.TAG);
        this.value = value;
    }
    public long getValue() {
        return value;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(value);
    }
    @Override
    public String toString() {
        return "Tag(" + value + ")";
    }
}
``` | 
	false | 
	@Test
    public void testEquals2() {
        Tag tag = new Tag(0);
        assertTrue(tag.equals(tag));
    } | 739 | 
	src/test/java/co/nstant/in/cbor/model/TagTest.java | 
	@Override
    public boolean equals(Object object) {
        if (object instanceof Tag) {
            Tag other = (Tag) object;
            return super.equals(object) && value == other.value;
        }
        return false;
    } | 285 | 
	src/main/java/co/nstant/in/cbor/model/Tag.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `ofByte` method in the `AdditionalInformation` class. Put new test methods inside the file `AdditionalInformationTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: AdditionalInformation.java
```
package co.nstant.in.cbor.model;
public enum AdditionalInformation {
    DIRECT(0), 
    ONE_BYTE(24), 
    TWO_BYTES(25), 
    FOUR_BYTES(26), 
    EIGHT_BYTES(27), 
    RESERVED(28), 
    INDEFINITE(31);
    private final int value;
    private AdditionalInformation(int value) {
        this.value = value;
    }
    public int getValue() {
        return value;
    }
    public static AdditionalInformation ofByte(int b) {
        switch (b & 31) {
        case 24:
            return ONE_BYTE;
        case 25:
            return TWO_BYTES;
        case 26:
            return FOUR_BYTES;
        case 27:
            return EIGHT_BYTES;
        case 28:
        case 29:
        case 30:
            return RESERVED;
        case 31:
            return INDEFINITE;
        default:
            return DIRECT;
        }
    }
}
```
File: AdditionalInformation.java
Package: co.nstant.in.cbor.model
```
/**
 * The initial byte of each data item contains both information about the major
 * type (the high-order 3 bits) and additional information (the low-order 5
 * bits). When the value of the additional information is less than 24, it is
 * directly used as a small unsigned integer. When it is 24 to 27, the
 * additional bytes for a variable-length integer immediately follow; the values
 * 24 to 27 of the additional information specify that its length is a 1-, 2-,
 * 4- or 8-byte unsigned integer, respectively. Additional information value 31
 * is used for indefinite length items, described in Section 2.2. Additional
 * information values 28 to 30 are reserved for future expansion.
 */
public enum AdditionalInformation {
    DIRECT(0), // 0-23
    ONE_BYTE(24), // 24
    TWO_BYTES(25), // 25
    FOUR_BYTES(26), // 26
    EIGHT_BYTES(27), // 27
    RESERVED(28), // 28-30
    INDEFINITE(31);
    private AdditionalInformation(int value) {
        this.value = value;
    }
    public int getValue();
    public static AdditionalInformation ofByte(int b);
}
``` | 
	AdditionalInformation | 
	ofByte | 
	AdditionalInformationTest.java | 
	JUnit4 | 
	File: AdditionalInformation.java
```
package co.nstant.in.cbor.model;
public enum AdditionalInformation {
    DIRECT(0), 
    ONE_BYTE(24), 
    TWO_BYTES(25), 
    FOUR_BYTES(26), 
    EIGHT_BYTES(27), 
    RESERVED(28), 
    INDEFINITE(31);
    private final int value;
    private AdditionalInformation(int value) {
        this.value = value;
    }
    public int getValue() {
        return value;
    }
    public static AdditionalInformation ofByte(int b) {
        switch (b & 31) {
        case 24:
            return ONE_BYTE;
        case 25:
            return TWO_BYTES;
        case 26:
            return FOUR_BYTES;
        case 27:
            return EIGHT_BYTES;
        case 28:
        case 29:
        case 30:
            return RESERVED;
        case 31:
            return INDEFINITE;
        default:
            return DIRECT;
        }
    }
}
```
File: AdditionalInformation.java
Package: co.nstant.in.cbor.model
```
/**
 * The initial byte of each data item contains both information about the major
 * type (the high-order 3 bits) and additional information (the low-order 5
 * bits). When the value of the additional information is less than 24, it is
 * directly used as a small unsigned integer. When it is 24 to 27, the
 * additional bytes for a variable-length integer immediately follow; the values
 * 24 to 27 of the additional information specify that its length is a 1-, 2-,
 * 4- or 8-byte unsigned integer, respectively. Additional information value 31
 * is used for indefinite length items, described in Section 2.2. Additional
 * information values 28 to 30 are reserved for future expansion.
 */
public enum AdditionalInformation {
    DIRECT(0), // 0-23
    ONE_BYTE(24), // 24
    TWO_BYTES(25), // 25
    FOUR_BYTES(26), // 26
    EIGHT_BYTES(27), // 27
    RESERVED(28), // 28-30
    INDEFINITE(31);
    private AdditionalInformation(int value) {
        this.value = value;
    }
    public int getValue();
    public static AdditionalInformation ofByte(int b);
}
``` | 
	false | 
	
    @Test
    public void shouldHandleReserved28() {
        Assert.assertEquals(AdditionalInformation.RESERVED, AdditionalInformation.ofByte(28));
        Assert.assertEquals(AdditionalInformation.RESERVED, AdditionalInformation.ofByte(29));
        Assert.assertEquals(AdditionalInformation.RESERVED, AdditionalInformation.ofByte(30));
    } | 129 | 
	src/test/java/co/nstant/in/cbor/model/AdditionalInformationTest.java | 
	public static AdditionalInformation ofByte(int b) {
        switch (b & 31) {
        case 24:
            return ONE_BYTE;
        case 25:
            return TWO_BYTES;
        case 26:
            return FOUR_BYTES;
        case 27:
            return EIGHT_BYTES;
        case 28:
        case 29:
        case 30:
            return RESERVED;
        case 31:
            return INDEFINITE;
        default:
            return DIRECT;
        }
    } | 1,119 | 
	src/main/java/co/nstant/in/cbor/model/AdditionalInformation.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `add` method in the `CborBuilder` class. Put new test methods inside the file `CborBuilderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborBuilder.java
```
package co.nstant.in.cbor;
import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
import co.nstant.in.cbor.builder.AbstractBuilder;
import co.nstant.in.cbor.builder.ArrayBuilder;
import co.nstant.in.cbor.builder.ByteStringBuilder;
import co.nstant.in.cbor.builder.MapBuilder;
import co.nstant.in.cbor.builder.UnicodeStringBuilder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.UnicodeString;
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    private final LinkedList<DataItem> dataItems = new LinkedList<>();
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset() {
        dataItems.clear();
        return this;
    }
    public List<DataItem> build() {
        return dataItems;
    }
    public CborBuilder add(DataItem dataItem) {
        dataItems.add(dataItem);
        return this;
    }
    public CborBuilder add(long value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(BigInteger value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(boolean value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(float value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(double value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(byte[] bytes) {
        add(convert(bytes));
        return this;
    }
    public ByteStringBuilder<CborBuilder> startByteString() {
        return startByteString(null);
    }
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes) {
        add(new ByteString(bytes).setChunked(true));
        return new ByteStringBuilder<CborBuilder>(this);
    }
    public CborBuilder add(String string) {
        add(convert(string));
        return this;
    }
    public UnicodeStringBuilder<CborBuilder> startString() {
        return startString(null);
    }
    public UnicodeStringBuilder<CborBuilder> startString(String string) {
        add(new UnicodeString(string).setChunked(true));
        return new UnicodeStringBuilder<CborBuilder>(this);
    }
    public CborBuilder addTag(long value) {
        add(tag(value));
        return this;
    }
    public CborBuilder tagged(long value) {
        DataItem item = dataItems.peekLast();
        if (item == null) {
            throw new IllegalStateException("Can't add a tag before adding an item");
        }
        item.getOuterTaggable().setTag(value);
        return this;
    }
    public ArrayBuilder<CborBuilder> startArray() {
        Array array = new Array();
        array.setChunked(true);
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public ArrayBuilder<CborBuilder> addArray() {
        Array array = new Array();
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public MapBuilder<CborBuilder> addMap() {
        Map map = new Map();
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    public MapBuilder<CborBuilder> startMap() {
        Map map = new Map();
        map.setChunked(true);
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    @Override
    protected void addChunk(DataItem dataItem) {
        add(dataItem);
    }
}
```
File: CborBuilder.java
Package: co.nstant.in.cbor
```
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset();
    public List<DataItem> build();
    public CborBuilder add(DataItem dataItem);
    public CborBuilder add(long value);
    public CborBuilder add(BigInteger value);
    public CborBuilder add(boolean value);
    public CborBuilder add(float value);
    public CborBuilder add(double value);
    public CborBuilder add(byte[] bytes);
    public ByteStringBuilder<CborBuilder> startByteString();
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes);
    public CborBuilder add(String string);
    public UnicodeStringBuilder<CborBuilder> startString();
    public UnicodeStringBuilder<CborBuilder> startString(String string);
    public CborBuilder addTag(long value);
    public CborBuilder tagged(long value);
    public ArrayBuilder<CborBuilder> startArray();
    public ArrayBuilder<CborBuilder> addArray();
    public MapBuilder<CborBuilder> addMap();
    public MapBuilder<CborBuilder> startMap();
    @Override
    protected void addChunk(DataItem dataItem);
}
```
File: AbstractBuilder.java
Package: co.nstant.in.cbor.builder
```
public abstract class AbstractBuilder<T> {
    public AbstractBuilder(T parent) {
        this.parent = parent;
    }
    }
``` | 
	CborBuilder | 
	add | 
	CborBuilderTest.java | 
	JUnit4 | 
	File: CborBuilder.java
```
package co.nstant.in.cbor;
import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
import co.nstant.in.cbor.builder.AbstractBuilder;
import co.nstant.in.cbor.builder.ArrayBuilder;
import co.nstant.in.cbor.builder.ByteStringBuilder;
import co.nstant.in.cbor.builder.MapBuilder;
import co.nstant.in.cbor.builder.UnicodeStringBuilder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.UnicodeString;
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    private final LinkedList<DataItem> dataItems = new LinkedList<>();
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset() {
        dataItems.clear();
        return this;
    }
    public List<DataItem> build() {
        return dataItems;
    }
    public CborBuilder add(DataItem dataItem) {
        dataItems.add(dataItem);
        return this;
    }
    public CborBuilder add(long value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(BigInteger value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(boolean value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(float value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(double value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(byte[] bytes) {
        add(convert(bytes));
        return this;
    }
    public ByteStringBuilder<CborBuilder> startByteString() {
        return startByteString(null);
    }
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes) {
        add(new ByteString(bytes).setChunked(true));
        return new ByteStringBuilder<CborBuilder>(this);
    }
    public CborBuilder add(String string) {
        add(convert(string));
        return this;
    }
    public UnicodeStringBuilder<CborBuilder> startString() {
        return startString(null);
    }
    public UnicodeStringBuilder<CborBuilder> startString(String string) {
        add(new UnicodeString(string).setChunked(true));
        return new UnicodeStringBuilder<CborBuilder>(this);
    }
    public CborBuilder addTag(long value) {
        add(tag(value));
        return this;
    }
    public CborBuilder tagged(long value) {
        DataItem item = dataItems.peekLast();
        if (item == null) {
            throw new IllegalStateException("Can't add a tag before adding an item");
        }
        item.getOuterTaggable().setTag(value);
        return this;
    }
    public ArrayBuilder<CborBuilder> startArray() {
        Array array = new Array();
        array.setChunked(true);
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public ArrayBuilder<CborBuilder> addArray() {
        Array array = new Array();
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public MapBuilder<CborBuilder> addMap() {
        Map map = new Map();
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    public MapBuilder<CborBuilder> startMap() {
        Map map = new Map();
        map.setChunked(true);
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    @Override
    protected void addChunk(DataItem dataItem) {
        add(dataItem);
    }
}
```
File: CborBuilder.java
Package: co.nstant.in.cbor
```
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset();
    public List<DataItem> build();
    public CborBuilder add(DataItem dataItem);
    public CborBuilder add(long value);
    public CborBuilder add(BigInteger value);
    public CborBuilder add(boolean value);
    public CborBuilder add(float value);
    public CborBuilder add(double value);
    public CborBuilder add(byte[] bytes);
    public ByteStringBuilder<CborBuilder> startByteString();
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes);
    public CborBuilder add(String string);
    public UnicodeStringBuilder<CborBuilder> startString();
    public UnicodeStringBuilder<CborBuilder> startString(String string);
    public CborBuilder addTag(long value);
    public CborBuilder tagged(long value);
    public ArrayBuilder<CborBuilder> startArray();
    public ArrayBuilder<CborBuilder> addArray();
    public MapBuilder<CborBuilder> addMap();
    public MapBuilder<CborBuilder> startMap();
    @Override
    protected void addChunk(DataItem dataItem);
}
```
File: AbstractBuilder.java
Package: co.nstant.in.cbor.builder
```
public abstract class AbstractBuilder<T> {
    public AbstractBuilder(T parent) {
        this.parent = parent;
    }
    }
``` | 
	false | 
	@Test
    public void shouldResetDataItems() {
        CborBuilder builder = new CborBuilder();
        builder.add(true);
        builder.add(1.0f);
        assertEquals(2, builder.build().size());
        builder.reset();
        assertEquals(0, builder.build().size());
    } | 279 | 
	src/test/java/co/nstant/in/cbor/CborBuilderTest.java | 
	public CborBuilder add(boolean value) {
        add(convert(value));
        return this;
    } | 1,228 | 
	src/main/java/co/nstant/in/cbor/CborBuilder.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `build` method in the `CborBuilder` class. Put new test methods inside the file `CborBuilderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborBuilder.java
```
package co.nstant.in.cbor;
import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
import co.nstant.in.cbor.builder.AbstractBuilder;
import co.nstant.in.cbor.builder.ArrayBuilder;
import co.nstant.in.cbor.builder.ByteStringBuilder;
import co.nstant.in.cbor.builder.MapBuilder;
import co.nstant.in.cbor.builder.UnicodeStringBuilder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.UnicodeString;
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    private final LinkedList<DataItem> dataItems = new LinkedList<>();
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset() {
        dataItems.clear();
        return this;
    }
    public List<DataItem> build() {
        return dataItems;
    }
    public CborBuilder add(DataItem dataItem) {
        dataItems.add(dataItem);
        return this;
    }
    public CborBuilder add(long value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(BigInteger value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(boolean value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(float value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(double value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(byte[] bytes) {
        add(convert(bytes));
        return this;
    }
    public ByteStringBuilder<CborBuilder> startByteString() {
        return startByteString(null);
    }
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes) {
        add(new ByteString(bytes).setChunked(true));
        return new ByteStringBuilder<CborBuilder>(this);
    }
    public CborBuilder add(String string) {
        add(convert(string));
        return this;
    }
    public UnicodeStringBuilder<CborBuilder> startString() {
        return startString(null);
    }
    public UnicodeStringBuilder<CborBuilder> startString(String string) {
        add(new UnicodeString(string).setChunked(true));
        return new UnicodeStringBuilder<CborBuilder>(this);
    }
    public CborBuilder addTag(long value) {
        add(tag(value));
        return this;
    }
    public CborBuilder tagged(long value) {
        DataItem item = dataItems.peekLast();
        if (item == null) {
            throw new IllegalStateException("Can't add a tag before adding an item");
        }
        item.getOuterTaggable().setTag(value);
        return this;
    }
    public ArrayBuilder<CborBuilder> startArray() {
        Array array = new Array();
        array.setChunked(true);
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public ArrayBuilder<CborBuilder> addArray() {
        Array array = new Array();
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public MapBuilder<CborBuilder> addMap() {
        Map map = new Map();
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    public MapBuilder<CborBuilder> startMap() {
        Map map = new Map();
        map.setChunked(true);
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    @Override
    protected void addChunk(DataItem dataItem) {
        add(dataItem);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	CborBuilder | 
	build | 
	CborBuilderTest.java | 
	JUnit4 | 
	File: CborBuilder.java
```
package co.nstant.in.cbor;
import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
import co.nstant.in.cbor.builder.AbstractBuilder;
import co.nstant.in.cbor.builder.ArrayBuilder;
import co.nstant.in.cbor.builder.ByteStringBuilder;
import co.nstant.in.cbor.builder.MapBuilder;
import co.nstant.in.cbor.builder.UnicodeStringBuilder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.ByteString;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.Map;
import co.nstant.in.cbor.model.UnicodeString;
public class CborBuilder extends AbstractBuilder<CborBuilder> {
    private final LinkedList<DataItem> dataItems = new LinkedList<>();
    public CborBuilder() {
        super(null);
    }
    public CborBuilder reset() {
        dataItems.clear();
        return this;
    }
    public List<DataItem> build() {
        return dataItems;
    }
    public CborBuilder add(DataItem dataItem) {
        dataItems.add(dataItem);
        return this;
    }
    public CborBuilder add(long value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(BigInteger value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(boolean value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(float value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(double value) {
        add(convert(value));
        return this;
    }
    public CborBuilder add(byte[] bytes) {
        add(convert(bytes));
        return this;
    }
    public ByteStringBuilder<CborBuilder> startByteString() {
        return startByteString(null);
    }
    public ByteStringBuilder<CborBuilder> startByteString(byte[] bytes) {
        add(new ByteString(bytes).setChunked(true));
        return new ByteStringBuilder<CborBuilder>(this);
    }
    public CborBuilder add(String string) {
        add(convert(string));
        return this;
    }
    public UnicodeStringBuilder<CborBuilder> startString() {
        return startString(null);
    }
    public UnicodeStringBuilder<CborBuilder> startString(String string) {
        add(new UnicodeString(string).setChunked(true));
        return new UnicodeStringBuilder<CborBuilder>(this);
    }
    public CborBuilder addTag(long value) {
        add(tag(value));
        return this;
    }
    public CborBuilder tagged(long value) {
        DataItem item = dataItems.peekLast();
        if (item == null) {
            throw new IllegalStateException("Can't add a tag before adding an item");
        }
        item.getOuterTaggable().setTag(value);
        return this;
    }
    public ArrayBuilder<CborBuilder> startArray() {
        Array array = new Array();
        array.setChunked(true);
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public ArrayBuilder<CborBuilder> addArray() {
        Array array = new Array();
        add(array);
        return new ArrayBuilder<CborBuilder>(this, array);
    }
    public MapBuilder<CborBuilder> addMap() {
        Map map = new Map();
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    public MapBuilder<CborBuilder> startMap() {
        Map map = new Map();
        map.setChunked(true);
        add(map);
        return new MapBuilder<CborBuilder>(this, map);
    }
    @Override
    protected void addChunk(DataItem dataItem) {
        add(dataItem);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test
    public void shouldAddTag() {
        CborBuilder builder = new CborBuilder();
        List<DataItem> dataItems = builder.addTag(1234).build();
        assertEquals(1, dataItems.size());
        assertTrue(dataItems.get(0) instanceof Tag);
        assertEquals(1234, ((Tag) dataItems.get(0)).getValue());
    } | 563 | 
	src/test/java/co/nstant/in/cbor/CborBuilderTest.java | 
	public List<DataItem> build() {
        return dataItems;
    } | 848 | 
	src/main/java/co/nstant/in/cbor/CborBuilder.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `toString` method in the `Special` class. Put new test methods inside the file `SpecialTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Special.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Special extends DataItem {
    public static final Special BREAK = new Special(SpecialType.BREAK);
    private final SpecialType specialType;
    protected Special(SpecialType specialType) {
        super(MajorType.SPECIAL);
        this.specialType = Objects.requireNonNull(specialType);
    }
    public SpecialType getSpecialType() {
        return specialType;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Special) {
            Special other = (Special) object;
            return super.equals(object) && specialType == other.specialType;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(specialType);
    }
    @Override
    public String toString() {
        return specialType.name();
    }
}
``` | 
	Special | 
	toString | 
	SpecialTest.java | 
	JUnit4 | 
	File: Special.java
```
package co.nstant.in.cbor.model;
import java.util.Objects;
public class Special extends DataItem {
    public static final Special BREAK = new Special(SpecialType.BREAK);
    private final SpecialType specialType;
    protected Special(SpecialType specialType) {
        super(MajorType.SPECIAL);
        this.specialType = Objects.requireNonNull(specialType);
    }
    public SpecialType getSpecialType() {
        return specialType;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Special) {
            Special other = (Special) object;
            return super.equals(object) && specialType == other.specialType;
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ Objects.hashCode(specialType);
    }
    @Override
    public String toString() {
        return specialType.name();
    }
}
``` | 
	false | 
	@Test
    public void testToString() {
        Special special = Special.BREAK;
        assertEquals("BREAK", special.toString());
    } | 136 | 
	src/test/java/co/nstant/in/cbor/model/SpecialTest.java | 
	@Override
    public String toString() {
        return specialType.name();
    } | 828 | 
	src/main/java/co/nstant/in/cbor/model/Special.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `add` method in the `Array` class. Put new test methods inside the file `ArrayTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Array.java
```
package co.nstant.in.cbor.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Array extends ChunkableDataItem {
    private final ArrayList<DataItem> objects;
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object) {
        objects.add(object);
        return this;
    }
    public List<DataItem> getDataItems() {
        return objects;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Array) {
            Array other = (Array) object;
            return super.equals(object) && objects.equals(other.objects);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ objects.hashCode();
    }
    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("[");
        if (isChunked()) {
            stringBuilder.append("_ ");
        }
        stringBuilder.append(Arrays.toString(objects.toArray()).substring(1));
        return stringBuilder.toString();
    }
    public DataItem peekLast() {
        if (objects.isEmpty()) {
            return null;
        }
        return objects.get(objects.size() - 1);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
```
File: Array.java
Package: co.nstant.in.cbor.model
```
public class Array extends ChunkableDataItem {
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object);
    public List<DataItem> getDataItems();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
    public DataItem peekLast();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
``` | 
	Array | 
	add | 
	ArrayTest.java | 
	JUnit4 | 
	File: Array.java
```
package co.nstant.in.cbor.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Array extends ChunkableDataItem {
    private final ArrayList<DataItem> objects;
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object) {
        objects.add(object);
        return this;
    }
    public List<DataItem> getDataItems() {
        return objects;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Array) {
            Array other = (Array) object;
            return super.equals(object) && objects.equals(other.objects);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ objects.hashCode();
    }
    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("[");
        if (isChunked()) {
            stringBuilder.append("_ ");
        }
        stringBuilder.append(Arrays.toString(objects.toArray()).substring(1));
        return stringBuilder.toString();
    }
    public DataItem peekLast() {
        if (objects.isEmpty()) {
            return null;
        }
        return objects.get(objects.size() - 1);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
```
File: Array.java
Package: co.nstant.in.cbor.model
```
public class Array extends ChunkableDataItem {
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object);
    public List<DataItem> getDataItems();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
    public DataItem peekLast();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
``` | 
	false | 
	@Test
    public void testHashcode() {
        Array array1 = new Array().add(new UnicodeString("string"));
        Array array2 = new Array().add(new UnicodeString("string"));
        assertEquals(array1.hashCode(), array2.hashCode());
    } | 339 | 
	src/test/java/co/nstant/in/cbor/model/ArrayTest.java | 
	public Array add(DataItem object) {
        objects.add(object);
        return this;
    } | 439 | 
	src/main/java/co/nstant/in/cbor/model/Array.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `add` method in the `Array` class. Put new test methods inside the file `ArrayTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: Array.java
```
package co.nstant.in.cbor.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Array extends ChunkableDataItem {
    private final ArrayList<DataItem> objects;
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object) {
        objects.add(object);
        return this;
    }
    public List<DataItem> getDataItems() {
        return objects;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Array) {
            Array other = (Array) object;
            return super.equals(object) && objects.equals(other.objects);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ objects.hashCode();
    }
    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("[");
        if (isChunked()) {
            stringBuilder.append("_ ");
        }
        stringBuilder.append(Arrays.toString(objects.toArray()).substring(1));
        return stringBuilder.toString();
    }
    public DataItem peekLast() {
        if (objects.isEmpty()) {
            return null;
        }
        return objects.get(objects.size() - 1);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
```
File: Array.java
Package: co.nstant.in.cbor.model
```
public class Array extends ChunkableDataItem {
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object);
    public List<DataItem> getDataItems();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
    public DataItem peekLast();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
``` | 
	Array | 
	add | 
	ArrayTest.java | 
	JUnit4 | 
	File: Array.java
```
package co.nstant.in.cbor.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Array extends ChunkableDataItem {
    private final ArrayList<DataItem> objects;
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object) {
        objects.add(object);
        return this;
    }
    public List<DataItem> getDataItems() {
        return objects;
    }
    @Override
    public boolean equals(Object object) {
        if (object instanceof Array) {
            Array other = (Array) object;
            return super.equals(object) && objects.equals(other.objects);
        }
        return false;
    }
    @Override
    public int hashCode() {
        return super.hashCode() ^ objects.hashCode();
    }
    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("[");
        if (isChunked()) {
            stringBuilder.append("_ ");
        }
        stringBuilder.append(Arrays.toString(objects.toArray()).substring(1));
        return stringBuilder.toString();
    }
    public DataItem peekLast() {
        if (objects.isEmpty()) {
            return null;
        }
        return objects.get(objects.size() - 1);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
```
File: Array.java
Package: co.nstant.in.cbor.model
```
public class Array extends ChunkableDataItem {
    public Array() {
        super(MajorType.ARRAY);
        objects = new ArrayList<>();
    }
    public Array(int initialCapacity) {
        super(MajorType.ARRAY);
        objects = new ArrayList<>(initialCapacity);
    }
    public Array add(DataItem object);
    public List<DataItem> getDataItems();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    @Override
    public String toString();
    public DataItem peekLast();
}
```
File: ChunkableDataItem.java
Package: co.nstant.in.cbor.model
```
class ChunkableDataItem extends DataItem {
    protected ChunkableDataItem(MajorType majorType) {
        super(majorType);
    }
    public boolean isChunked();
    public ChunkableDataItem setChunked(boolean chunked);
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
}
``` | 
	false | 
	@Test
    public void testToString() {
        Array array = new Array().add(new UnicodeString("a"));
        assertEquals("[a]", array.toString());
        array.setChunked(true);
        assertEquals("[_ a]", array.toString());
        array.add(new UnicodeString("b"));
        assertEquals("[_ a, b]", array.toString());
        array.setChunked(false);
        assertEquals("[a, b]", array.toString());
    } | 587 | 
	src/test/java/co/nstant/in/cbor/model/ArrayTest.java | 
	public Array add(DataItem object) {
        objects.add(object);
        return this;
    } | 439 | 
	src/main/java/co/nstant/in/cbor/model/Array.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `decodeNext` method in the `CborDecoder` class. Put new test methods inside the file `CborDecoderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	CborDecoder | 
	decodeNext | 
	CborDecoderTest.java | 
	JUnit4 | 
	File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
```
File: DataItem.java
Package: co.nstant.in.cbor.model
```
public class DataItem {
    protected DataItem(MajorType majorType) {
        this.majorType = majorType;
        Objects.requireNonNull(majorType, "majorType is null");
    }
    public MajorType getMajorType();
    public void setTag(long tag);
    public void setTag(Tag tag);
    public void removeTag();
    public Tag getTag();
    public boolean hasTag();
    @Override
    public boolean equals(Object object);
    @Override
    public int hashCode();
    public DataItem getOuterTaggable();
}
``` | 
	false | 
	@Test(expected = CborException.class)
    public void shouldThrowCborException2() throws CborException {
        CborDecoder cborDecoder = new CborDecoder(new InputStream() {
            @Override
            public int read() throws IOException {
                return (8 << 5);
            }
        });
        cborDecoder.decodeNext();
    } | 1,307 | 
	src/test/java/co/nstant/in/cbor/decoder/CborDecoderTest.java | 
	/**
     * Decodes exactly one DataItem from the input stream.
     *
     * @return a {@link DataItem} or null if end of stream has reached.
     * @throws CborException if decoding failed
     */
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    } | 4,185 | 
	src/main/java/co/nstant/in/cbor/CborDecoder.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `isAutoDecodeInfinitiveMaps` method in the `CborDecoder` class. Put new test methods inside the file `CborDecoderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
``` | 
	CborDecoder | 
	isAutoDecodeInfinitiveMaps | 
	CborDecoderTest.java | 
	JUnit4 | 
	File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
``` | 
	false | 
	@Test
    public void shouldSetAutoDecodeInfinitiveMaps() {
        InputStream inputStream = new ByteArrayInputStream(new byte[] { 0, 1, 2 });
        CborDecoder cborDecoder = new CborDecoder(inputStream);
        assertTrue(cborDecoder.isAutoDecodeInfinitiveMaps());
        cborDecoder.setAutoDecodeInfinitiveMaps(false);
        assertFalse(cborDecoder.isAutoDecodeInfinitiveMaps());
    } | 1,683 | 
	src/test/java/co/nstant/in/cbor/decoder/CborDecoderTest.java | 
	public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    } | 8,698 | 
	src/main/java/co/nstant/in/cbor/CborDecoder.java | 
	method | ||
| 
	https://github.com/c-rack/cbor-java.git | 
	Apache License 2.0 | 
	cabd70d02e864354117d73d96d70ab021d748188 | 
	java | 
	Write tests for the `isAutoDecodeRationalNumbers` method in the `CborDecoder` class. Put new test methods inside the file `CborDecoderTest.java`.
*Guideline:*
- Test file should be complete and compilable, without need for further actions.
- Write a description of the class and the method being tested.
- Ensure that each test focuses on a single use case to maintain clarity and readability.
- Instead of using `@BeforeEach` methods for setup, include all necessary code initialization within each individual test method, do not write parametrized tests.
- Use libraries available in the project: JUnit4.
*Sources:*
File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
``` | 
	CborDecoder | 
	isAutoDecodeRationalNumbers | 
	CborDecoderTest.java | 
	JUnit4 | 
	File: CborDecoder.java
```
package co.nstant.in.cbor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import co.nstant.in.cbor.decoder.ArrayDecoder;
import co.nstant.in.cbor.decoder.ByteStringDecoder;
import co.nstant.in.cbor.decoder.MapDecoder;
import co.nstant.in.cbor.decoder.NegativeIntegerDecoder;
import co.nstant.in.cbor.decoder.SpecialDecoder;
import co.nstant.in.cbor.decoder.TagDecoder;
import co.nstant.in.cbor.decoder.UnicodeStringDecoder;
import co.nstant.in.cbor.decoder.UnsignedIntegerDecoder;
import co.nstant.in.cbor.model.Array;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.LanguageTaggedString;
import co.nstant.in.cbor.model.MajorType;
import co.nstant.in.cbor.model.Number;
import co.nstant.in.cbor.model.RationalNumber;
import co.nstant.in.cbor.model.Tag;
import co.nstant.in.cbor.model.UnicodeString;
public class CborDecoder {
    private final InputStream inputStream;
    private final UnsignedIntegerDecoder unsignedIntegerDecoder;
    private final NegativeIntegerDecoder negativeIntegerDecoder;
    private final ByteStringDecoder byteStringDecoder;
    private final UnicodeStringDecoder unicodeStringDecoder;
    private final ArrayDecoder arrayDecoder;
    private final MapDecoder mapDecoder;
    private final TagDecoder tagDecoder;
    private final SpecialDecoder specialDecoder;
    private boolean autoDecodeInfinitiveArrays = true;
    private boolean autoDecodeInfinitiveMaps = true;
    private boolean autoDecodeInfinitiveByteStrings = true;
    private boolean autoDecodeInfinitiveUnicodeStrings = true;
    private boolean autoDecodeRationalNumbers = true;
    private boolean autoDecodeLanguageTaggedStrings = true;
    private boolean rejectDuplicateKeys = false;
    public CborDecoder(InputStream inputStream) {
        Objects.requireNonNull(inputStream);
        this.inputStream = inputStream;
        unsignedIntegerDecoder = new UnsignedIntegerDecoder(this, inputStream);
        negativeIntegerDecoder = new NegativeIntegerDecoder(this, inputStream);
        byteStringDecoder = new ByteStringDecoder(this, inputStream);
        unicodeStringDecoder = new UnicodeStringDecoder(this, inputStream);
        arrayDecoder = new ArrayDecoder(this, inputStream);
        mapDecoder = new MapDecoder(this, inputStream);
        tagDecoder = new TagDecoder(this, inputStream);
        specialDecoder = new SpecialDecoder(this, inputStream);
    }
    public static List<DataItem> decode(byte[] bytes) throws CborException {
        return new CborDecoder(new ByteArrayInputStream(bytes)).decode();
    }
    public List<DataItem> decode() throws CborException {
        List<DataItem> dataItems = new LinkedList<>();
        DataItem dataItem;
        while ((dataItem = decodeNext()) != null) {
            dataItems.add(dataItem);
        }
        return dataItems;
    }
    public void decode(DataItemListener dataItemListener) throws CborException {
        Objects.requireNonNull(dataItemListener);
        DataItem dataItem = decodeNext();
        while (dataItem != null) {
            dataItemListener.onDataItem(dataItem);
            dataItem = decodeNext();
        }
    }
    public DataItem decodeNext() throws CborException {
        int symbol;
        try {
            symbol = inputStream.read();
        } catch (IOException ioException) {
            throw new CborException(ioException);
        }
        if (symbol == -1) {
            return null;
        }
        switch (MajorType.ofByte(symbol)) {
        case ARRAY:
            return arrayDecoder.decode(symbol);
        case BYTE_STRING:
            return byteStringDecoder.decode(symbol);
        case MAP:
            return mapDecoder.decode(symbol);
        case NEGATIVE_INTEGER:
            return negativeIntegerDecoder.decode(symbol);
        case UNICODE_STRING:
            return unicodeStringDecoder.decode(symbol);
        case UNSIGNED_INTEGER:
            return unsignedIntegerDecoder.decode(symbol);
        case SPECIAL:
            return specialDecoder.decode(symbol);
        case TAG:
            Tag tag = tagDecoder.decode(symbol);
            DataItem next = decodeNext();
            if (next == null) {
                throw new CborException("Unexpected end of stream: tag without following data item.");
            } else {
                if (autoDecodeRationalNumbers && tag.getValue() == 30) {
                    return decodeRationalNumber(next);
                } else if (autoDecodeLanguageTaggedStrings && tag.getValue() == 38) {
                    return decodeLanguageTaggedString(next);
                } else {
                    DataItem itemToTag = next;
                    while (itemToTag.hasTag())
                        itemToTag = itemToTag.getTag();
                    itemToTag.setTag(tag);
                    return next;
                }
            }
        case INVALID:
        default:
            throw new CborException("Not implemented major type " + symbol);
        }
    }
    private DataItem decodeLanguageTaggedString(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding LanguageTaggedString: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding LanguageTaggedString: array size is not 2");
        }
        DataItem languageDataItem = array.getDataItems().get(0);
        if (!(languageDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: first data item is not an UnicodeString");
        }
        DataItem stringDataItem = array.getDataItems().get(1);
        if (!(stringDataItem instanceof UnicodeString)) {
            throw new CborException("Error decoding LanguageTaggedString: second data item is not an UnicodeString");
        }
        UnicodeString language = (UnicodeString) languageDataItem;
        UnicodeString string = (UnicodeString) stringDataItem;
        return new LanguageTaggedString(language, string);
    }
    private DataItem decodeRationalNumber(DataItem dataItem) throws CborException {
        if (!(dataItem instanceof Array)) {
            throw new CborException("Error decoding RationalNumber: not an array");
        }
        Array array = (Array) dataItem;
        if (array.getDataItems().size() != 2) {
            throw new CborException("Error decoding RationalNumber: array size is not 2");
        }
        DataItem numeratorDataItem = array.getDataItems().get(0);
        if (!(numeratorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: first data item is not a number");
        }
        DataItem denominatorDataItem = array.getDataItems().get(1);
        if (!(denominatorDataItem instanceof Number)) {
            throw new CborException("Error decoding RationalNumber: second data item is not a number");
        }
        Number numerator = (Number) numeratorDataItem;
        Number denominator = (Number) denominatorDataItem;
        return new RationalNumber(numerator, denominator);
    }
    public boolean isAutoDecodeInfinitiveArrays() {
        return autoDecodeInfinitiveArrays;
    }
    public void setAutoDecodeInfinitiveArrays(boolean autoDecodeInfinitiveArrays) {
        this.autoDecodeInfinitiveArrays = autoDecodeInfinitiveArrays;
    }
    public boolean isAutoDecodeInfinitiveMaps() {
        return autoDecodeInfinitiveMaps;
    }
    public void setAutoDecodeInfinitiveMaps(boolean autoDecodeInfinitiveMaps) {
        this.autoDecodeInfinitiveMaps = autoDecodeInfinitiveMaps;
    }
    public boolean isAutoDecodeInfinitiveByteStrings() {
        return autoDecodeInfinitiveByteStrings;
    }
    public void setAutoDecodeInfinitiveByteStrings(boolean autoDecodeInfinitiveByteStrings) {
        this.autoDecodeInfinitiveByteStrings = autoDecodeInfinitiveByteStrings;
    }
    public boolean isAutoDecodeInfinitiveUnicodeStrings() {
        return autoDecodeInfinitiveUnicodeStrings;
    }
    public void setAutoDecodeInfinitiveUnicodeStrings(boolean autoDecodeInfinitiveUnicodeStrings) {
        this.autoDecodeInfinitiveUnicodeStrings = autoDecodeInfinitiveUnicodeStrings;
    }
    public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    }
    public void setAutoDecodeRationalNumbers(boolean autoDecodeRationalNumbers) {
        this.autoDecodeRationalNumbers = autoDecodeRationalNumbers;
    }
    public boolean isAutoDecodeLanguageTaggedStrings() {
        return autoDecodeLanguageTaggedStrings;
    }
    public void setAutoDecodeLanguageTaggedStrings(boolean autoDecodeLanguageTaggedStrings) {
        this.autoDecodeLanguageTaggedStrings = autoDecodeLanguageTaggedStrings;
    }
    public boolean isRejectDuplicateKeys() {
        return rejectDuplicateKeys;
    }
    public void setRejectDuplicateKeys(boolean rejectDuplicateKeys) {
        this.rejectDuplicateKeys = rejectDuplicateKeys;
    }
    public void setMaxPreallocationSize(int maxSize) {
        unsignedIntegerDecoder.setMaxPreallocationSize(maxSize);
        negativeIntegerDecoder.setMaxPreallocationSize(maxSize);
        byteStringDecoder.setMaxPreallocationSize(maxSize);
        unicodeStringDecoder.setMaxPreallocationSize(maxSize);
        arrayDecoder.setMaxPreallocationSize(maxSize);
        mapDecoder.setMaxPreallocationSize(maxSize);
        tagDecoder.setMaxPreallocationSize(maxSize);
        specialDecoder.setMaxPreallocationSize(maxSize);
    }
}
``` | 
	false | 
	@Test
    public void shouldSetAutoDecodeRationalNumbers() {
        InputStream inputStream = new ByteArrayInputStream(new byte[] { 0, 1, 2 });
        CborDecoder cborDecoder = new CborDecoder(inputStream);
        assertTrue(cborDecoder.isAutoDecodeRationalNumbers());
        cborDecoder.setAutoDecodeRationalNumbers(false);
        assertFalse(cborDecoder.isAutoDecodeRationalNumbers());
    } | 2,083 | 
	src/test/java/co/nstant/in/cbor/decoder/CborDecoderTest.java | 
	public boolean isAutoDecodeRationalNumbers() {
        return autoDecodeRationalNumbers;
    } | 9,553 | 
	src/main/java/co/nstant/in/cbor/CborDecoder.java | 
	method | 
End of preview. Expand
						in Data Studio
					
	README.md exists but content is empty.
								
- Downloads last month
- 23
