Buggy code:
public abstract class NoTxKeyValueTableTest { private static final byte [ ] KEY1 = Bytes . toBytes ( "key1" ) ; private static final byte [ ] KEY2 = Bytes . toBytes ( "key2" ) ; private static final byte [ ] VALUE1 = Bytes . toBytes ( "value1" ) ; private static final byte [ ] VALUE2 = Bytes . toBytes ( "value2" ) ; private static final Map < String , String > NO_ARGS = DatasetDefinition . NO_ARGUMENTS ; private static final String namespaceId = "testNamespace" ; protected static final Namespace NAMESPACE_ID = Namespace . from ( "myspace" ) ; protected abstract DatasetDefinition < ? extends NoTxKeyValueTable , ? extends DatasetAdmin > getDefinition ( ) throws IOException { } @ Test public void test ( ) throws IOException { DefaultDatasetNamespace dsNamespace = new DefaultDatasetNamespace ( CConfiguration . create ( ) ) ; String name = dsNamespace . namespace ( NoTxKeyValueTableTest . NAMESPACE_ID , "table" ) ; DatasetDefinition < ? extends NoTxKeyValueTable , ? extends DatasetAdmin > def = getDefinition ( ) ; DatasetSpecification spec = def . configure ( name , EMPTY ) ; ClassLoader cl = NoTxKeyValueTable . class . getClassLoader ( ) ; <START_BUG> DatasetContext datasetContext = new DatasetContext . Builder ( ) . setNamespaceId ( NoTxKeyValueTableTest . namespaceId ) . build ( ) ; <END_BUG> DatasetAdmin admin = def . getAdmin ( datasetContext , spec , cl ) ; Assert . assertFalse ( admin . exists ( ) ) ; admin . create ( ) ; Assert . assertTrue ( admin . exists ( ) ) ; NoTxKeyValueTable table = def . getDataset ( datasetContext , spec , NoTxKeyValueTableTest . NO_ARGS , cl ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; table . put ( NoTxKeyValueTableTest . KEY1 , NoTxKeyValueTableTest . VALUE1 ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE1 , table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; table . put ( NoTxKeyValueTableTest . KEY1 , NoTxKeyValueTableTest . VALUE2 ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE2 , table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; table . put ( NoTxKeyValueTableTest . KEY2 , NoTxKeyValueTableTest . VALUE1 ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE2 , table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE1 , table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; table . put ( NoTxKeyValueTableTest . KEY2 , null ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE2 , table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; admin . truncate ( ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; Assert . assertTrue ( admin . exists ( ) ) ; admin . drop ( ) ; Assert . assertFalse ( admin . exists ( ) ) ; admin . create ( ) ; Assert . assertTrue ( admin . exists ( ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY2 ) ) ; table . put ( NoTxKeyValueTableTest . KEY1 , NoTxKeyValueTableTest . VALUE1 ) ; Assert . assertArrayEquals ( NoTxKeyValueTableTest . VALUE1 , table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; admin . drop ( ) ; Assert . assertFalse ( admin . exists ( ) ) ; admin . create ( ) ; Assert . assertTrue ( admin . exists ( ) ) ; Assert . assertNull ( table . get ( NoTxKeyValueTableTest . KEY1 ) ) ; } }

Fix:
DatasetContext datasetContext = DatasetContext . from ( NoTxKeyValueTableTest . namespaceId ) ;