Java
10
Вклад в тег
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import static org.mockito.Mockito.*;
@Configuration
public class MockConfiguration {
@Primary
@Bean
public ActivitiGetTimerValueDelegateService activitiGetTimerValueDelegateService() {
ActivitiGetTimerValueDelegateService service = mock(ActivitiGetTimerValueDelegateService.class);
when(service.getTimerValue(any(), any(), any())).thenReturn(42);
return service;
}
}
BufferedReader br = new BufferedReader(new FileReader("matrix.txt"));
List<String> lines = new ArrayList<>();
while (br.ready()) {
lines.add(br.readLine());
}
int matrixWidth = lines.get(0).split(" ").length;
int matrixHeight = lines.size();
Double[][] matrix = new Double[matrixHeight][matrixWidth];
for (int i = 0; i < matrixHeight; i++) {
for (int j = 0; j < matrixWidth; j++) {
String[] line = lines.get(i).split(" ");
matrix[i][j] = Double.parseDouble(line[j]);
}
}
for (int i = 0; i < matrixHeight; i++) {
System.out.println(Arrays.toString(matrix[i]));
}