Package employee.satisfactionStrategy

Source Code of employee.satisfactionStrategy.SatisfactionStrategyBasedOnCountryAverageTest

package employee.satisfactionStrategy;

import employee.Answer;
import employee.IEmployee;
import employee.ISatisfactionStrategy;
import org.junit.Before;
import org.junit.Test;

import java.math.BigDecimal;

import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

/**
* Created by Wojciech Milewski on 12/7/13.
*/
public class SatisfactionStrategyBasedOnCountryAverageTest {
    private ISatisfactionStrategy instance;

    @Before
    public void setUp() throws Exception {
        instance = new SatisfactionStrategyBasedOnCountryAverage();
    }

    @Test
    public void getSatisfaction_shouldReturnLowWhenSalaryIsBelowAverage() {
        //given
        IEmployee employee = mock(IEmployee.class);
        given(employee.getSalary()).willReturn(BigDecimal.ONE);
        //when
        final Answer satisfaction = instance.getSatisfaction(employee);
        //then
        assertThat(satisfaction).isEqualTo(Answer.BAD);
    }

    @Test
    public void getSatisfaction_shouldReturnHighWhenSalaryIsEqualOrOverAverage() {
        //given
        IEmployee employee = mock(IEmployee.class);
        given(employee.getSalary()).willReturn(BigDecimal.valueOf(10000));
        //when
        final Answer satisfaction = instance.getSatisfaction(employee);
        //then
        assertThat(satisfaction).isEqualTo(Answer.FINE);
    }
}
TOP

Related Classes of employee.satisfactionStrategy.SatisfactionStrategyBasedOnCountryAverageTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.