package com.github.masahitojp.botan.brain;

import lombok.val;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.stream.Collectors;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class LocalBrainTest {

    private BotanBrain data;

    @BeforeEach
    public void startUp() {
        data = new LocalBrain();
    }

    @Test
    public void testSet() {
        val key = "test";
        val value = "test_abc";

        assertEquals(data.getData().get(key), null);
        assertEquals(data.getData().put(key, value), null);
        assertEquals(data.getData().get("test"), value);
        assertEquals(data.getData().remove("test"), value);
        assertEquals(data.getData().get(key), null);
    }

    @Test
    public void search() {
        val key = "test";
        val value = "test_abc";

        data.getData().put(key, value);
        data.getData().put("test2", "test2");
        data.getData().put("key", "value");

        final List<String> list = data.getData().keySet().stream().filter(x -> x.startsWith("test")).collect(Collectors.toList());
        assertEquals(list.size(), 2);
        assertTrue(list.contains(key));
    }

}
@@ -312,16 +312,75 @@
 ertTrue;
+%0Aimport static org.junit.jupiter.api.Assertions.assertNull;
 %0A%0Apublic
@@ -621,38 +621,36 @@
 %0A%0A        assert
-Equals
+Null
 (data.getData().
@@ -653,30 +653,24 @@
 a().get(key)
-, null
 );%0A        a
@@ -666,38 +666,36 @@
 ;%0A        assert
-Equals
+Null
 (data.getData().
@@ -709,22 +709,16 @@
 , value)
-, null
 );%0A     
@@ -835,38 +835,36 @@
 ;%0A        assert
-Equals
+Null
 (data.getData().
@@ -875,14 +875,8 @@
 key)
-, null
 );%0A 

use assertNull