1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 package org.rocksdb;
7 
8 import org.junit.Test;
9 
10 import static org.assertj.core.api.Assertions.assertThat;
11 
12 public class CompactionStopStyleTest {
13 
14   @Test(expected = IllegalArgumentException.class)
failIfIllegalByteValueProvided()15   public void failIfIllegalByteValueProvided() {
16     CompactionStopStyle.getCompactionStopStyle((byte) -1);
17   }
18 
19   @Test
getCompactionStopStyle()20   public void getCompactionStopStyle() {
21     assertThat(CompactionStopStyle.getCompactionStopStyle(
22         CompactionStopStyle.CompactionStopStyleTotalSize.getValue()))
23             .isEqualTo(CompactionStopStyle.CompactionStopStyleTotalSize);
24   }
25 
26   @Test
valueOf()27   public void valueOf() {
28     assertThat(CompactionStopStyle.valueOf("CompactionStopStyleSimilarSize")).
29         isEqualTo(CompactionStopStyle.CompactionStopStyleSimilarSize);
30   }
31 }
32