<commit_before>package no.priv.bang.ukelonn.impl;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import javax.faces.event.ActionEvent;

import org.junit.BeforeClass;
import org.junit.Test;
import org.ops4j.pax.jdbc.derby.impl.DerbyDataSourceFactory;
import org.osgi.service.jdbc.DataSourceFactory;

import no.priv.bang.ukelonn.bundle.test.db.UkelonnDatabaseProvider;

public class UkelonnControllerTest {

    @BeforeClass
    public static void setupFakeOsgiServices() {
        UkelonnServiceProvider ukelonnServiceSingleton = new UkelonnServiceProvider();
        UkelonnDatabaseProvider ukelonnDatabaseProvider = new UkelonnDatabaseProvider();
        DataSourceFactory derbyDataSourceFactory = new DerbyDataSourceFactory();
        ukelonnDatabaseProvider.setDataSourceFactory(derbyDataSourceFactory);
        ukelonnServiceSingleton.setUkelonnDatabase(ukelonnDatabaseProvider.get());
    }

    @Test
    public void testFornavn() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jod");
        assertEquals("John", ukelonn.getFornavn());
        ukelonn.setFornavn("Kari");
        assertEquals("Kari", ukelonn.getFornavn());
    }

    @Test
    public void testBalanse() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jad");
        assertEquals(Double.valueOf(0), ukelonn.getBalanse());
        ukelonn.setBalanse(Double.valueOf(-1));
        assertEquals(Double.valueOf(-1), ukelonn.getBalanse());
    }

    @Test
    public void testJobs() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jad");
        assertEquals(3, ukelonn.getJobs().size());
    }

    @Test
    public void testAddJob() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jod");
        assertEquals(Double.valueOf(0), ukelonn.getBalanse());
        assertEquals(2, ukelonn.getJobs().size());
        TransactionType newJobType = ukelonn.getJobTypes().get(0);
        ukelonn.setNewJobType(newJobType);
        ukelonn.setNewJobWages(newJobType.getTransactionAmount());
        ukelonn.registerNewJob(mock(ActionEvent.class));
        assertEquals(Double.valueOf(35), ukelonn.getBalanse());
        assertEquals(3, ukelonn.getJobs().size());
    }
}<commit_msg>Test fixes: change expected values after adding more transactions to the test database.<commit_after>package no.priv.bang.ukelonn.impl;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import javax.faces.event.ActionEvent;

import org.junit.BeforeClass;
import org.junit.Test;
import org.ops4j.pax.jdbc.derby.impl.DerbyDataSourceFactory;
import org.osgi.service.jdbc.DataSourceFactory;

import no.priv.bang.ukelonn.bundle.test.db.UkelonnDatabaseProvider;

public class UkelonnControllerTest {

    @BeforeClass
    public static void setupFakeOsgiServices() {
        UkelonnServiceProvider ukelonnServiceSingleton = new UkelonnServiceProvider();
        UkelonnDatabaseProvider ukelonnDatabaseProvider = new UkelonnDatabaseProvider();
        DataSourceFactory derbyDataSourceFactory = new DerbyDataSourceFactory();
        ukelonnDatabaseProvider.setDataSourceFactory(derbyDataSourceFactory);
        ukelonnServiceSingleton.setUkelonnDatabase(ukelonnDatabaseProvider.get());
    }

    @Test
    public void testFornavn() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jod");
        assertEquals("John", ukelonn.getFornavn());
        ukelonn.setFornavn("Kari");
        assertEquals("Kari", ukelonn.getFornavn());
    }

    @Test
    public void testBalanse() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jad");
        assertEquals(673.0, ukelonn.getBalanse(), 0.1);
        ukelonn.setBalanse(Double.valueOf(-1));
        assertEquals(Double.valueOf(-1), ukelonn.getBalanse());
    }

    @Test
    public void testJobs() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jad");
        assertEquals(33, ukelonn.getJobs().size());
    }

    @Test
    public void testAddJob() {
        UkelonnController ukelonn = new UkelonnController();
        ukelonn.setUsername("jod");
        assertEquals(Double.valueOf(0), ukelonn.getBalanse());
        assertEquals(2, ukelonn.getJobs().size());
        TransactionType newJobType = ukelonn.getJobTypes().get(0);
        ukelonn.setNewJobType(newJobType);
        ukelonn.setNewJobWages(newJobType.getTransactionAmount());
        ukelonn.registerNewJob(mock(ActionEvent.class));
        assertEquals(Double.valueOf(35), ukelonn.getBalanse());
        assertEquals(3, ukelonn.getJobs().size());
    }
}
{'fraction_non_alphanumeric': 0.11269974768713205, 'fraction_numerical': 0.005887300252312868, 'mean_word_length': 3.814777327935223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1222986', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1456, 'n_words': 221}