@Test public void GetAllNotFinished_InvalidJson_ReturnsEmpty() throws Exception { Map<String, String> values = new HashMap<String, String>(); values.put("10", "{foo: 3}"); values.put("11", "{buildId: }"); values.put("12", ""); stub(storage.getValues()).toReturn(values); Bisect[] actual = sut.getAllNotFinished(); assertEquals(actual.length, 0); }
public Bisect[] getAllNotFinished() { List<Bisect> result = new ArrayList<Bisect>(); Map<String, String> values = storage.getValues(); if (values != null) { for (String key : values.keySet()) { Bisect bisect = tryParse(values.get(key)); if (bisect != null && !bisect.isFinished()) { result.add(bisect); } } } return result.toArray(new Bisect[result.size()]); }
BisectRepository { public Bisect[] getAllNotFinished() { List<Bisect> result = new ArrayList<Bisect>(); Map<String, String> values = storage.getValues(); if (values != null) { for (String key : values.keySet()) { Bisect bisect = tryParse(values.get(key)); if (bisect != null && !bisect.isFinished()) { result.add(bisect); } } } return result.toArray(new Bisect[result.size()]); } }
BisectRepository { public Bisect[] getAllNotFinished() { List<Bisect> result = new ArrayList<Bisect>(); Map<String, String> values = storage.getValues(); if (values != null) { for (String key : values.keySet()) { Bisect bisect = tryParse(values.get(key)); if (bisect != null && !bisect.isFinished()) { result.add(bisect); } } } return result.toArray(new Bisect[result.size()]); } BisectRepository(CustomDataStorage storage); }
BisectRepository { public Bisect[] getAllNotFinished() { List<Bisect> result = new ArrayList<Bisect>(); Map<String, String> values = storage.getValues(); if (values != null) { for (String key : values.keySet()) { Bisect bisect = tryParse(values.get(key)); if (bisect != null && !bisect.isFinished()) { result.add(bisect); } } } return result.toArray(new Bisect[result.size()]); } BisectRepository(CustomDataStorage storage); boolean exists(long buildId); void create(long buildId); Bisect[] getAllNotFinished(); Bisect get(long buildId); void save(Bisect bisect); }
BisectRepository { public Bisect[] getAllNotFinished() { List<Bisect> result = new ArrayList<Bisect>(); Map<String, String> values = storage.getValues(); if (values != null) { for (String key : values.keySet()) { Bisect bisect = tryParse(values.get(key)); if (bisect != null && !bisect.isFinished()) { result.add(bisect); } } } return result.toArray(new Bisect[result.size()]); } BisectRepository(CustomDataStorage storage); boolean exists(long buildId); void create(long buildId); Bisect[] getAllNotFinished(); Bisect get(long buildId); void save(Bisect bisect);  }