<commit_before>package uk.dangrew.nuts.graphics.tutorial.database;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;

import javafx.scene.Node;
import javafx.scene.control.Button;
import uk.dangrew.kode.launch.TestApplication;
import uk.dangrew.kode.model.BuilderVerifier;
import uk.dangrew.nuts.graphics.common.UiEnumTypeSelectionDialog;
import uk.dangrew.nuts.graphics.database.FoodTypes;
import uk.dangrew.nuts.graphics.database.UiDatabaseManagerPane;
import uk.dangrew.nuts.graphics.table.ConceptTable;

public class DatabaseComponentsTest {

   private DatabaseComponents systemUnderTest;

   @Before public void initialiseSystemUnderTest() {
      TestApplication.startPlatform();
      MockitoAnnotations.initMocks( this );
      systemUnderTest = new DatabaseComponents();
   }//End Method

   @Test public void shouldBuild() {
      new BuilderVerifier<>()
         .buildObject( systemUnderTest::withMainTable, systemUnderTest::mainTable, mock( ConceptTable.class ) )
         .buildObject( systemUnderTest::withMainTableAddButton, systemUnderTest::mainTableAddButton, mock( Button.class ) )
         .buildObject( systemUnderTest::withMainTableFoodTypeDialog, systemUnderTest::mainTableFoodTypeDialog, mock( UiEnumTypeSelectionDialog.class ) );
   }//End Method

   @Test public void shouldRegenerate(){
      UiDatabaseManagerPane parent = systemUnderTest.parent();
      Node mainTable = systemUnderTest.mainTable();
      Node mainTableButton = systemUnderTest.mainTableAddButton();
      UiEnumTypeSelectionDialog< FoodTypes > dialog = systemUnderTest.mainTableFoodTypeDialog();
      
      systemUnderTest.generateComponents();
      assertThat( systemUnderTest.parent(), is( not( parent ) ) );
      assertThat( systemUnderTest.mainTable(), is( not( mainTable ) ) );
      assertThat( systemUnderTest.mainTableAddButton(), is( not( mainTableButton ) ) );
      assertThat( systemUnderTest.mainTableFoodTypeDialog(), is( not( dialog ) ) );
   }//End Method<commit_msg>FIXED GENERICS ISSUE:<commit_after>package uk.dangrew.nuts.graphics.tutorial.database;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import javafx.scene.Node;
import javafx.scene.control.Button;
import uk.dangrew.kode.launch.TestApplication;
import uk.dangrew.kode.model.BuilderVerifier;
import uk.dangrew.nuts.food.Food;
import uk.dangrew.nuts.graphics.common.UiEnumTypeSelectionDialog;
import uk.dangrew.nuts.graphics.database.FoodTypes;
import uk.dangrew.nuts.graphics.database.UiDatabaseManagerPane;
import uk.dangrew.nuts.graphics.table.ConceptTable;

public class DatabaseComponentsTest {

   @Mock private ConceptTable< Food > table;
   private DatabaseComponents systemUnderTest;

   @Before public void initialiseSystemUnderTest() {
      TestApplication.startPlatform();
      MockitoAnnotations.initMocks( this );
      systemUnderTest = new DatabaseComponents();
   }//End Method

   @Test public void shouldBuild() {
      new BuilderVerifier<>()
         .buildObject( systemUnderTest::withMainTable, systemUnderTest::mainTable, table )
         .buildObject( systemUnderTest::withMainTableAddButton, systemUnderTest::mainTableAddButton, mock( Button.class ) )
         .buildObject( systemUnderTest::withMainTableFoodTypeDialog, systemUnderTest::mainTableFoodTypeDialog, mock( UiEnumTypeSelectionDialog.class ) );
   }//End Method

   @Test public void shouldRegenerate(){
      UiDatabaseManagerPane parent = systemUnderTest.parent();
      Node mainTable = systemUnderTest.mainTable();
      Node mainTableButton = systemUnderTest.mainTableAddButton();
      UiEnumTypeSelectionDialog< FoodTypes > dialog = systemUnderTest.mainTableFoodTypeDialog();
      
      systemUnderTest.generateComponents();
      assertThat( systemUnderTest.parent(), is( not( parent ) ) );
      assertThat( systemUnderTest.mainTable(), is( not( mainTable ) ) );
      assertThat( systemUnderTest.mainTableAddButton(), is( not( mainTableButton ) ) );
      assertThat( systemUnderTest.mainTableFoodTypeDialog(), is( not( dialog ) ) );
   }//End Method
{'fraction_non_alphanumeric': 0.10118647862099843, 'fraction_numerical': 0.0, 'mean_word_length': 4.981258366800535, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '20421', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1249, 'n_words': 243}