History log of /libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java
Revision Date Author Comments
d4b7449574ca69c713a3f2230cb77c68ee642700 06-Sep-2016 Tobias Thierer <tobiast@google.com> Fix 58 libcore tests that caught "expected" Exceptions but didn't fail()

There were no changes to code under test.

4 tests were fixed to not tolerate an Exception:
- libcore.java.util.CollectionsTest#test_CheckedMap_computeIfAbsent
In the case where a Map key is present, computeIfAbsent() should
not invoke the Function, so there is no return value that could
be expected to undergo a type check. The test was changed to
verify that the Function is not invoked.
- libcore.java.util.concurrent.CopyOnWriteArrayListTest#test_sort and
libcore.java.util.concurrent.CopyOnWriteArrayListTest#test_subList_sort
were sorting an already-sorted non-null list that contains no null
values. That logic was redundant and wouldn't have thrown.
- org.apache.harmony.security.tests.java.security.KeyStoreSpiTest#test_engineEntryInstanceOf
(the KeyStoreSpi documentation does not mention whether NPE is thrown;
the implementation comes from upstream and does not throw it).

54 tests were fixed by adding the missing
fail();
No attempt was made to make this failure message specific to the
exception that was expected.

Tests that weren't changed:

- SSLEngineTest.test_wrap_ByteBuffer_ByteBuffer_04() requires
investigation to determine the correct resolution.
A comment was added to the test linking to the corresponding bug.

- ThreadTest#testParkUntilWithUnderflowValue() and
OldNodeChangeEventTest.waitForEvent() were not touched since
it was not clear whether that it was relevent to the test whether
or not the exception was thrown.

- two cases in Files2Test#test_setPosixFilePermissions_NPE() are
left to a future CL

Test:
(croot; make vogar core-tests) \
&& git diff aosp/master --name-only | xargs vogar `cparg core-tests`

Change-Id: I1cd3220a06e331ff049b146b393f78879f07211a
baba65acea294729ddc335466c70a5647fccf37b 18-Apr-2016 Shubham Ajmera <shubhamajmera@google.com> Add unit tests for FileChannel#lock #tryLock

The change adds more test for FileChannel #lock and #tryLock.

The change also includes test for overlapping lock using different file
channels.

Bug: 27186422
(cherry-picked from commit fb376ca44c4c3ed1d53b93f32712c4efc9490a76)
Change-Id: Ib040bb28d8ce8417d2cd8fb2c81a9d50519e8fde
fb376ca44c4c3ed1d53b93f32712c4efc9490a76 18-Apr-2016 Shubham Ajmera <shubhamajmera@google.com> Add unit tests for FileChannel#lock #tryLock

The change adds more test for FileChannel #lock and #tryLock.

The change also includes test for overlapping lock using different file
channels.

Bug: 27186422
Change-Id: Ib040bb28d8ce8417d2cd8fb2c81a9d50519e8fde
55f4e6492769b61850c43750a9182a017119e473 06-Aug-2015 Narayan Kamath <narayan@google.com> Fix bogus fix in FileChannelImpl.

We should truncate if the requested size is *less* than the
file size, not greater.

Also update test expectations for Channels from appendable
FileOutputStreams. They must be positioned at the end of the file.

Change-Id: I214e9f1ed8d1833c85a801e96191ff61998a2d5b
0aff1dd0b4be1b8d8cb45b59079ca883a1b3205a 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

(cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.)

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
63744c884dd4b4f4307f2b021fb894af164972af 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
a10637a26dc17501789edde0f4675e1639741f71 12-Mar-2014 Neil Fuller <nfuller@google.com> 1.7 interoperability changes for FileLock

Adding acquiredBy(). This method is effectively a synonym for
channel().

Change-Id: Ifa0b89debb42a7181f1f5f188ae7175970286adb
e5fea3d504609d22337a5311d3ce0e72314bceee 15-Nov-2013 Narayan Kamath <narayan@google.com> Use a consistent package path for harmony tests.

Harmony was never consistent about where they put their
tests. There's no reason we have to be the same.

Also, there's no need to have separate subtrees for nio,
nio_char etc. etc.

This change makes all existing apache harmony tests
subpackages of "org.apache.harmony.tests" and put them under
libcore/harmony-tests.

We somehow managed to end up with two vastly different
copies of CharsetDecoderTest & CharsetEncoderTest. I've
renamed the copies CharsetDecoder2Test & CharsetEncoder2Test
to avoid having to go in and resolve the complicated
diffs or speculate about the reasons for their
divergence.

Change-Id: Ic34e69c2faab8893edd54e05eccd7091f4a09abd