Skip to content

Instantly share code, notes, and snippets.

View naotawool's full-sized avatar

Naotake naotawool

  • Matsuyama, Ehime, Japan
View GitHub Profile
@naotawool
naotawool / StandardJUnit5Test.java
Created June 27, 2018 09:16
Eclipse を使って JUnit5 を導入したときのメモ ref: https://qiita.com/naotawool/items/a8d77ff9d468fedab2c9
package learning.junit5;
import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.condition.OS.*;
import java.util.Map;
import org.assertj.core.util.Maps;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
@naotawool
naotawool / UnitTestSnippet.md
Created September 1, 2016 14:40
ユニットテストでよく使用するスニペット (for Eclipse)

事前処理 (BF)

@${testType:newType(org.junit.Before)}
public void setUp() throws Exception {
   ${cursor} 
}

事後処理 (AF)

@naotawool
naotawool / WiremockLearningTest.java
Created August 30, 2016 15:38
Wiremock 動作確認ソース
package salarycalculation.web.resources;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.assertj.core.api.Assertions.assertThat;
import java.net.HttpURLConnection;
import java.net.URL;
@naotawool
naotawool / 多次元配列の並列化サンプル.java
Created August 28, 2016 11:50
多次元配列の並列化サンプル
package unittest;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
@naotawool
naotawool / Case1-1 問題の局所化.java
Last active October 8, 2018 13:48
ゆるふわユニットテスト実践入門
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import org.junit.Before;
import org.junit.Test;
public class CalculatorTest {
private Calculator testee;
@naotawool
naotawool / AfterEmployeeDomain.java
Created May 28, 2016 06:54
Refactoring Study Sample (2-1)
public int getAnnualTotalSalaryPlan() {
// 基準内給与
int standardSalary = baseSalary() + capabilityRankAllowance();
// 想定年収
int annualTotalSalaryPlan = (standardSalary) * 12;
return annualTotalSalaryPlan;
}
@naotawool
naotawool / AfterEmployeeDao.java
Last active May 28, 2016 06:52
Refactoring Study Sample (1-1)
public List<Employee> findByRole(String rank) {
String query = "select * from employee where roleRank = ? order by no";
return findByQuery(query, rank);
}
public List<Employee> findByCapability(String rank) {
String query = "select * from employee where capabilityRank = ? order by no";
return findByQuery(query, rank);
}
@naotawool
naotawool / MainActivity.java
Created November 23, 2015 10:24
BLE Connect Prototype
package com.example.ble;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
@naotawool
naotawool / AssertJArrayLearning.java
Created November 22, 2015 16:30
AssertJ Learning
import static org.assertj.core.api.Assertions.assertThat;
import org.assertj.core.util.Arrays;
import org.junit.Test;
public class AssertJArrayLearning {
@Test
public void contains() {
String[] actuals = Arrays.array("Lucy", "Debit", "Anna", "Jack");
@naotawool
naotawool / phpunit_only.xml
Last active August 29, 2015 13:57
PHPUnit only
<phpunit
bootstrap="bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="true"
stopOnError="false"
stopOnFailure="false"
stopOnSkipped="false"