S3WritableByteChannel implements WritableByteChannel { @VisibleForTesting static boolean atMostOne(boolean... values) { boolean one = false; for (boolean value : values) { if (!one && value) { one = true; } else if (value) { return false; } } return true; } S3WritableByteChannel(AmazonS3 amazonS3, S3ResourceId path, String contentType, S3Options options); @Override int write(ByteBuffer sourceBuffer); @Override boolean isOpen(); @Override void close();  }
@Test public void testAtMostOne() { assertTrue(atMostOne(true)); assertTrue(atMostOne(false)); assertFalse(atMostOne(true, true)); assertTrue(atMostOne(true, false)); assertTrue(atMostOne(false, true)); assertTrue(atMostOne(false, false)); assertFalse(atMostOne(true, true, true)); assertFalse(atMostOne(true, true, false)); assertFalse(atMostOne(true, false, true)); assertTrue(atMostOne(true, false, false)); assertFalse(atMostOne(false, true, true)); assertTrue(atMostOne(false, true, false)); assertTrue(atMostOne(false, false, true)); assertTrue(atMostOne(false, false, false)); }