use of uk.ivanc.archimvvm.viewmodel.ItemRepoViewModel in project archi by ivacf.
the class ItemRepoViewModelTest method shouldGetStars.
@Test
public void shouldGetStars() {
Repository repository = new Repository();
repository.stars = 10;
String expectedString = application.getString(R.string.text_stars, repository.stars);
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
assertEquals(expectedString, itemRepoViewModel.getStars());
}
use of uk.ivanc.archimvvm.viewmodel.ItemRepoViewModel in project archi by ivacf.
the class ItemRepoViewModelTest method shouldGetWatchers.
@Test
public void shouldGetWatchers() {
Repository repository = new Repository();
repository.watchers = 7;
String expectedString = application.getString(R.string.text_watchers, repository.watchers);
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
assertEquals(expectedString, itemRepoViewModel.getWatchers());
}
use of uk.ivanc.archimvvm.viewmodel.ItemRepoViewModel in project archi by ivacf.
the class ItemRepoViewModelTest method shouldNotifyPropertyChangeWhenSetRepository.
@Test
public void shouldNotifyPropertyChangeWhenSetRepository() {
Repository repository = new Repository();
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
Observable.OnPropertyChangedCallback mockCallback = mock(Observable.OnPropertyChangedCallback.class);
itemRepoViewModel.addOnPropertyChangedCallback(mockCallback);
itemRepoViewModel.setRepository(repository);
verify(mockCallback).onPropertyChanged(any(Observable.class), anyInt());
}
use of uk.ivanc.archimvvm.viewmodel.ItemRepoViewModel in project archi by ivacf.
the class ItemRepoViewModelTest method shouldStartActivityOnItemClick.
@Test
public void shouldStartActivityOnItemClick() {
Repository repository = new Repository();
Context mockContext = mock(Context.class);
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(mockContext, repository);
itemRepoViewModel.onItemClick(new View(application));
verify(mockContext).startActivity(any(Intent.class));
}
use of uk.ivanc.archimvvm.viewmodel.ItemRepoViewModel in project archi by ivacf.
the class ItemRepoViewModelTest method shouldGetName.
@Test
public void shouldGetName() {
Repository repository = new Repository();
repository.name = "ivan";
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
assertEquals(repository.name, itemRepoViewModel.getName());
}
Aggregations