This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sunilsahoo.sonarqube; | |
import androidx.annotation.VisibleForTesting; | |
public class PrivateMethodUtils { | |
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) | |
boolean isEmpty(String str) { | |
return (str == null || str.length() == 0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sunilsahoo.sonarqube; | |
public class PrivateMethodUtils { | |
private boolean isEmpty(String str) { | |
return (str == null || str.length() == 0); | |
} | |
public boolean isCsv(String str) { | |
if (isEmpty(str)) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sunilsahoo.sonarqube.validator; | |
import androidx.lifecycle.LiveData; | |
import androidx.lifecycle.MediatorLiveData; | |
import androidx.lifecycle.ViewModel; | |
public class HomeViewModel extends ViewModel { | |
private MediatorLiveData<String> liveData = new MediatorLiveData<>(); | |
public LiveData<String> getLiveData() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
import io.reactivex.Scheduler; | |
import io.reactivex.android.plugins.RxAndroidPlugins; | |
import io.reactivex.plugins.RxJavaPlugins; | |
import io.reactivex.schedulers.Schedulers; | |
public class RxImmediateSchedulerRule implements TestRule { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextUtils { | |
private TextUtils(){ | |
} | |
/** | |
* Returns true if the string is null or 0-length. | |
* @param str the string to be examined | |
* @return true if str is null or zero length | |
*/ | |
public static boolean isEmpty(CharSequence str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sunilsahoo.unittesting.utils; | |
public class Utils { | |
private Utils(){ | |
} | |
public static int divide(String dividend, String divisor){ | |
return Integer.parseInt(dividend)/Integer.parseInt(divisor); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sunilsahoo.unittesting.test; | |
import org.junit.jupiter.api.*; | |
class AnnotationTest { | |
@BeforeAll | |
static void setup(){ | |
System.out.println("@BeforeAll executed"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { INCREMENT, DECREMENT } from "./types"; | |
export const incrementBy = by => { | |
return { | |
type: INCREMENT, | |
payload: by | |
}; | |
}; | |
export const decrementBy = by => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { INCREMENT, DECREMENT } from "../actions/types"; | |
const initialState = { | |
counter: 0 | |
}; | |
const counterReducer = (state = initialState, action) => { | |
switch (action.type) { | |
case INCREMENT: | |
return { | |
...state, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers } from "redux"; | |
import counterReducer from "../reducers/counterReducer"; | |
const rootReducer = combineReducers({ | |
counterOperation: counterReducer | |
}); | |
const configureStore = () => { | |
return createStore(rootReducer); | |
}; |
NewerOlder